一键导入
arkts-error-fixes
Solutions for ArkTS compilation errors and type mismatches. Load this skill when compilation fails or when fixing ArkTS type errors.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Solutions for ArkTS compilation errors and type mismatches. Load this skill when compilation fails or when fixing ArkTS type errors.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Load for ArkTS/JavaScript jscrash, runtime crash, uncaught exception, stack trace, faultlog, or hilog diagnosis. Also load when the app 闪退/崩溃/白屏, exits after 点击/启动/launch, or build succeeds but runtime fails (no compile error). Use before broad Read/Glob on crash-only tasks.
Load this skill when creating, initializing, or scaffolding an ArkTS project, including "0-1", "from scratch", "new ArkTS project", "新建工程", "创建项目", and empty directory initialization tasks. Load this skill even if the target directory already exists — never assume an existing same-named directory is the user's intended project and skip to build_project/start_app. If the user provides a Chinese or other non-ASCII project name (e.g. 购物车, 天气预报), you MUST propose 2-3 UpperCamelCase ASCII candidates (e.g. 购物车 → ShoppingCart / ShopCart / Cart) and let the user choose via AskUserQuestion BEFORE invoking the script — never pass non-ASCII names through to the script, and never pick a single translation on the user's behalf. Use the skill's private TypeScript script to create ArkTS projects reliably.
Load this skill when writing or modifying .ets files. Use it for ArkTS syntax rules, ArkTS-specific restrictions, TypeScript-to-ArkTS syntax differences, syntax compliance review, and ArkTS syntax questions.
Load this skill when answering ArkUI UI questions or when writing/modifying ArkUI components, layouts, state-driven UI, rendering control, navigation, dialogs, interactions, component APIs, or ArkUI declarative UI in .ets files.
Sync upstream OpenCode releases into the DevEco Code fork. Use when the user asks to sync, merge, or update from the OpenCode upstream (e.g. "sync upstream", "merge OpenCode v1.14.xx", "update from upstream"). Covers git graft repair, merge analysis, conflict resolution with brand preservation (DEVECO_*), squash commit workflow, and post-sync verification.
| name | arkts-error-fixes |
| description | Solutions for ArkTS compilation errors and type mismatches. Load this skill when compilation fails or when fixing ArkTS type errors. |
This skill provides solutions for common ArkTS compilation errors and type mismatches encountered during HarmonyOS development.
| Category | Description |
|---|---|
| Notification API Type Errors | ContentType type incompatibility |
| Window API Type Errors | Type inference issues with window.getLastWindow |
| AppStorage Type Errors | Type inference errors with AppStorage.get() |
| Object Spread Type Errors | Type inference issues with object spread |
| @StorageLink Default Value Errors | Missing default values for @StorageLink properties |
| Object Literal Interface Errors | Object literals without explicit interfaces |
| Object Literal Type Errors | Using object literal types in return type annotations |
| Function Return Type Errors | Limited return type inference |
| Arrow Function Conversion Errors | Using function expressions instead of arrow functions |
| Color Property Errors | Non-existent Color properties |
| Interface Method Signature Errors | Method signature mismatches in object literals |
| AvoidArea Type Errors | Missing visible property in AvoidArea type |
Standalone Function this Errors | Using this in standalone functions |
| TitleButtonRect Type Errors | Incorrect return type for getTitleButtonRect; accessing non-existent properties (left, top) |
| Catch Clause Type Errors | Type annotations in catch clauses |
| ESObject Type Errors | Restricted usage of ESObject type |
| Resource Conversion Errors | Resource to string/number conversion errors |
| Unused Variable Warnings | Declared but never used variables |
| IDataSource Type Errors | LazyForEach requires IDataSource implementation |
| Duplicate Entry Errors | Multiple @Entry decorators in same file |
| Possibly Null Errors | Object possibly null when accessing properties |
| Error Type | Solution |
|---|---|
| Notification type error | Cast to number type |
| Window type error | Use callback pattern for getLastWindow |
| AppStorage type error | Use @StorageLink with LocalStorage or AppStorage.setAndLink (avoid setOrCreate) |
| Object spread error | Explicitly type objects |
| @StorageLink default value error | Add = undefined or specific default value |
| Object literal interface error | Define interface before using object literal |
| Object literal type error | Define interface and use it as return type |
| Function return type error | Add explicit return type annotation |
| Arrow function conversion error | Convert function to arrow function => |
| Color property error | Use hex color values instead of non-existent Color properties |
| Interface method signature error | Use property syntax method: () => {} instead of method syntax |
| AvoidArea type error | Add visible: false property to AvoidArea object |
Standalone function this error | Pass context as parameter: function foo(context: Context) |
| TitleButtonRect type error | Use window.TitleButtonRect instead of window.Rect; only width and height properties available |
| Catch clause type error | Remove type annotation or use any/unknown |
| ESObject type error | Use ESModule or specific types instead of ESObject |
| Resource conversion error | Use Resource directly in UI components or use ResourceManager |
| Unused variable warning | Use console.info/hilog or delete unused variable |
| IDataSource type error | Implement IDataSource interface for LazyForEach |
| Duplicate Entry error | Remove extra @Entry, use @Component for child components |
| Possibly Null error | Use !== null check or optional chaining |
this Errors