android2harmony 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/api-analyzer.md +113 -0
- package/agents/app-action.md +122 -0
- package/agents/code-reviewer.md +191 -295
- package/agents/coder.md +377 -0
- package/agents/self-tester.md +8 -8
- package/agents/spec-designer.md +56 -0
- package/package.json +1 -1
- package/skills/a2h-app-req-gen/SKILL.md +174 -0
- package/skills/a2h-app-req-gen/references/spec-handoff.md +99 -0
- package/skills/a2h-app-req-gen/references/subagent-render.md +115 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/build.gradle.kts +41 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradle.properties +3 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradlew +251 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradlew.bat +94 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/settings.gradle.kts +17 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawAnalysisDetector.java +1911 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawIssueRegistry.java +37 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawJson.java +146 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawLocation.java +96 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawRecordWriter.java +227 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/resources/dev/reqgen/analyzer/jvm/raw-record-v1.schema.json +93 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/assets/dashboard.html +151 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/gradle/reqgen-lint.init.gradle +60 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/gradle/reqgen-model.init.gradle +204 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/package.json +14 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/backend.js +323 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/cli.js +811 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/gap-audit-link.js +62 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/index.js +66 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/merge.js +605 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/name-trace.js +153 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/orchestrate.js +1324 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/output-parse.js +50 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/overview.js +10 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/pool.js +23 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/post-merge-fix.js +146 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/prompt-loader.js +51 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/prompt.js +967 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/prompts.md +301 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/serve.js +78 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/short-id.js +46 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/snapshot.js +267 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/types.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/validate.js +122 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/callback-call-sites.js +62 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/gap-audit/build.js +1291 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/gap-audit/index.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/area-ownership.js +392 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/build.js +1995 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/callback-flow.js +277 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/component-variants.js +725 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/index.js +15 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/names/index.js +12 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/names/policy.js +469 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/names/traceability.js +468 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/req-model/build.js +1066 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/req-model/index.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/android-interaction-registry.js +174 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/android.js +1062 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/area-titles.js +678 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/builder.js +350 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/compose-api-registry.js +395 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/compose-call-sites.js +2008 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/compose.js +9059 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/dynamic-repeated-call-sites.js +529 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/index.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/interaction-effects.js +1149 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/jvm.js +6272 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/normalize.js +33 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/pending-intents.js +565 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/resource-id.js +42 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/route-state-variants.js +781 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/state.js +234 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/types.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/android/extract.js +40 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/android/index.js +6 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/android/manifest.js +513 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/android/resources.js +398 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/android/types.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/android/views.js +447 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/android/xml-parser.js +175 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/cli.js +398 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/area-graph.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/artifact.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/common.js +16 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/diagnostic.js +10 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/gap-audit.js +14 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/index.js +11 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/name-traceability.js +26 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/raw-fact.js +40 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/req-model.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/run.js +19 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/semantic-completeness.js +11 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/source-facts.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/core/output-guard.js +41 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/core/stable-id.js +92 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/dashboard-cli.js +169 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/diagnostics.js +104 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/dump/dump.js +1028 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/dump/index.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/dump-cli.js +251 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/artifacts.js +49 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/index.js +18 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/quality-report.js +125 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/render.js +353 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/types.js +2 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/graph/paths.js +474 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/jvm/index.js +15 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/jvm/protocol.js +408 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/jvm/runner.js +452 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/pipeline/index.js +8 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/pipeline/output.js +165 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/pipeline/run-stage1.js +891 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/project/discovery.js +299 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/project/gradle-model.js +358 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/project/gradle-runner.js +165 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/project/resource-profile.js +60 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/project/types.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/spec-handoff-cli.js +151 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/spec-handoff.js +1004 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/stage2-cli.js +109 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/stage2-input.js +419 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/stage2-name-trace-input.js +95 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/area-graph.js +444 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/index.js +7 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/req-model.js +580 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/req-text.js +195 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/semantic-area-graph.js +1431 -0
- package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/types.js +1 -0
- package/skills/a2h-app-req-gen/scripts/reqgen-audit.mjs +298 -0
- package/skills/a2h-app-req-gen/scripts/reqgen-selfcheck.mjs +555 -0
- package/skills/a2h-code-review/SKILL.md +379 -0
- package/skills/{hmos-integration-test → a2h-integration-test}/README.md +6 -6
- package/skills/{hmos-integration-test → a2h-integration-test}/SKILL.md +6 -6
- package/skills/{hmos-integration-test → a2h-integration-test}/scripts/report-tool.mjs +1 -1
- package/skills/a2h-spec-design/SKILL.md +330 -0
- package/skills/a2h-spec-design/scripts/inspect_spec_design_inputs.mjs +207 -0
- package/skills/a2h-spec-design/scripts/move_spec_technical_reference.mjs +198 -0
- package/skills/a2h-spec-design/scripts/validate_spec_design_output.mjs +256 -0
- package/skills/a2h-spec-generate/SKILL.md +696 -0
- package/skills/a2h-spec-generate/references/trace-template.md +115 -0
- package/skills/a2h-spec-generate/scripts/parse_requirements.mjs +537 -0
- package/skills/a2h-spec-generate/template/REQ.txt +22 -0
- package/skills/a2h-spec-generate/template/REQ.xlsx +0 -0
- package/skills/a2h-spec-implement/SKILL.md +548 -0
- package/skills/a2h-spec-implement/references/harmony-pitfalls.md +186 -0
- package/skills/a2h-spec-implement/references/l1-unit-test.md +185 -0
- package/skills/a2h-spec-implement/references/l3-e2e-uitest.md +167 -0
- package/skills/a2h-spec-implement/references/test-core.md +132 -0
- package/skills/a2h-spec-implement/rules/arkts/arkts-standards.md +184 -0
- package/skills/a2h-spec-implement/rules/arkts/conventions/coding-style.md +96 -0
- package/skills/a2h-spec-implement/rules/arkts/conventions/security.md +126 -0
- package/skills/a2h-spec-implement/rules/arkts/language/arkts-rules.md +650 -0
- package/skills/a2h-spec-implement/rules/arkts/language/arkui-structure-rules.md +173 -0
- package/skills/a2h-spec-implement/rules/arkts/language/ts-to-arkts-rewrites.md +58 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2089 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +903 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +355 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +216 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +442 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +169 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +763 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +2088 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1258 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Once/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +175 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Param/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +850 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +862 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +110 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +301 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1411 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +1392 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/getTarget/346/216/245/345/217/243/357/274/232/350/216/267/345/217/226/347/212/266/346/200/201/347/256/241/347/220/206/346/241/206/346/236/266/344/273/243/347/220/206/345/211/215/347/232/204/345/216/237/345/247/213/345/257/271/350/261/241.md +288 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/makeObserved/346/216/245/345/217/243/357/274/232/345/260/206/351/235/236/350/247/202/345/257/237/346/225/260/346/215/256/345/217/230/344/270/272/345/217/257/350/247/202/345/257/237/346/225/260/346/215/256.md +768 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/222/214V2/346/267/267/347/224/250/346/214/207/345/257/274/357/274/210API version 19/345/217/212/344/271/213/345/220/216/357/274/211.md" +829 -0
- package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206/346/246/202/350/277/260.md +184 -0
- package/skills/a2h-spec-implement/rules/arkts/ui/component-cookbook.md +431 -0
- package/skills/a2h-spec-implement/rules/arkts/ui/state-management.md +152 -0
- package/skills/a2h-spec-implement/rules/arkts/ui/ui-quality.md +67 -0
- package/skills/a2h-spec-implement/rules/arkts/ui/ui-runtime-diagnosis.md +32 -0
- package/skills/a2h-spec-implement/rules/pipeline/build/package-set-collection.md +43 -0
- package/skills/a2h-spec-implement/scripts/_lib/common.mjs +97 -0
- package/skills/a2h-spec-implement/scripts/_lib/config.mjs +70 -0
- package/skills/a2h-spec-implement/scripts/_lib/lessons_cli.mjs +48 -0
- package/skills/a2h-spec-implement/scripts/build_lessons.mjs +24 -0
- package/skills/a2h-spec-implement/scripts/code_pattern_lessons.mjs +26 -0
- package/skills/a2h-spec-implement/scripts/device_ui.mjs +433 -0
- package/skills/a2h-spec-implement/scripts/device_ui_core.mjs +895 -0
- package/skills/a2h-spec-implement/scripts/ledger/aggregate_run.mjs +207 -0
- package/skills/a2h-spec-implement/scripts/manifest/emit_summary_line.mjs +37 -0
- package/skills/a2h-spec-implement/scripts/manifest/finalize_run.mjs +115 -0
- package/skills/a2h-spec-implement/scripts/manifest/render_final_summary.mjs +78 -0
- package/skills/a2h-spec-implement/scripts/manifest/root_mirror.mjs +137 -0
- package/skills/a2h-spec-implement/scripts/package.json +12 -0
- package/skills/a2h-spec-implement/scripts/state_propagation_check.mjs +676 -0
- package/skills/a2h-spec-implement/scripts/test/l2_run.mjs +244 -0
- package/skills/a2h-spec-implement/scripts/test/tp_coverage.mjs +231 -0
- package/skills/a2h-spec-implement/scripts/ui_memory.mjs +161 -0
- package/skills/a2h-spec-implement/scripts/utils/ensure_app.mjs +134 -0
- package/skills/a2h-ui-transfer/SKILL.md +20 -9
- package/skills/a2h-ui-transfer/scripts/arkts_static_check.js +80 -0
- package/skills/hmos-convert-pipeline/SKILL.md +7 -5
- package/skills/hmos-incremental-ui-align/README.md +7 -7
- package/skills/hmos-incremental-ui-align/SKILL.md +1 -1
- package/skills/hmos-incremental-ui-align/page_align.md +1 -1
- package/skills/hmos-spec-generate/SKILL.md +2 -2
- package/skills/hmos-spec-generate/scripts/parse_requirements.mjs +537 -0
- package/skills/hmos-fix-build-errors/SKILL.md +0 -266
- package/skills/hmos-fix-build-errors/references/arkts-strict-patterns.md +0 -219
- package/skills/hmos-fix-build-errors/references/known-patterns.md +0 -157
- package/skills/hmos-fix-build-errors/references/rdb-entity-pattern.md +0 -131
- package/skills/hmos-spec-generate/scripts/parse_requirements.ts +0 -515
- /package/skills/{hmos-integration-test → a2h-integration-test}/scripts/resolve-metadata-tool.mjs +0 -0
- /package/skills/{hmos-integration-test → a2h-integration-test}/scripts/self-test-runner.mjs +0 -0
- /package/skills/{hmos-integration-test → a2h-integration-test}/scripts/testcases-tool.mjs +0 -0
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
# ArkTS Syntax Rules Dictionary
|
|
2
|
+
|
|
3
|
+
Complete ArkTS linter rule reference. Rules are anchored to official rule tags (`arkts-*`), matching compiler/linter error messages one-to-one.
|
|
4
|
+
|
|
5
|
+
- Target version: **ArkTSLinter 1.1** (standard ArkTS, not arkts-1.2 strict mode)
|
|
6
|
+
- Sources: linter rule set + the official "TypeScript to ArkTS Migration Guide" (typescript-to-arkts-migration-guide)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Explicitly allowed constructs
|
|
11
|
+
|
|
12
|
+
Commonly mis-banned — do not avoid these "defensively". This table is the **single source of truth** for the whitelist (`../arkts-standards.md` and `ts-to-arkts-rewrites.md` only carry pointers here).
|
|
13
|
+
|
|
14
|
+
The following are **fully legal** in ArkTS; use them normally when generating code:
|
|
15
|
+
|
|
16
|
+
| Construct | Notes |
|
|
17
|
+
|-----------|-------|
|
|
18
|
+
| Template literals `` `Count: ${count}` `` | Fully supported; `Text(`${this.msg}`)` is idiomatic ArkUI |
|
|
19
|
+
| `value as T` assertions | `as` is the **only** supported assertion syntax (`arkts-as-casts` bans the angle-bracket form `<T>value`, not `as`) |
|
|
20
|
+
| `Record<K, V>` | Officially supported utility type and the **recommended** replacement for index signatures; indexed access `rec['key']` on a `Record` is allowed (result type includes `undefined`) |
|
|
21
|
+
| `Partial<T>` / `Required<T>` / `Readonly<T>` | Officially supported (`Partial<T>`'s T must be a class or interface) |
|
|
22
|
+
| Arrow functions (including as passed values) | Recommended style |
|
|
23
|
+
| `async` / `await` / `Promise` | Supported |
|
|
24
|
+
| Getters / setters | Supported |
|
|
25
|
+
| Generic classes, interfaces, functions (`function f<T>()`) | Supported (generic **arrow functions** excepted — see `arkts-no-generic-lambdas`) |
|
|
26
|
+
| Array spread: `[...arr1, ...arr2]` | Array spread is supported (object spread — see `arkts-no-spread`) |
|
|
27
|
+
| `typeof x` in expression context | Supported (type context `type T = typeof x` is banned — see `arkts-no-type-query`) |
|
|
28
|
+
| `new RegExp("pattern")` | Supported (regex **literals** `/pattern/` are banned — see `arkts-no-regexp-literals`) |
|
|
29
|
+
| Union types `A \| B`, type aliases (non-object-literal form) | Supported |
|
|
30
|
+
| `for...of`, `Map`, `Set` | Supported |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Rule Index
|
|
35
|
+
|
|
36
|
+
84 rules. Severity: ERROR must be fixed; WARNING should be fixed. Migratable = Yes means a mechanical rewrite exists.
|
|
37
|
+
|
|
38
|
+
| Ref | Rule Tag | Severity | Migratable | Description |
|
|
39
|
+
|-----|----------|----------|------------|-------------|
|
|
40
|
+
| 1 | `arkts-identifiers-as-prop-names` | ERROR | Yes | Object property names must be valid identifiers (or string literals) |
|
|
41
|
+
| 2 | `arkts-no-symbol` | ERROR | - | `Symbol()` API is not supported (except `Symbol.iterator`) |
|
|
42
|
+
| 3 | `arkts-no-private-identifiers` | ERROR | Yes | `#` private fields are not supported; use `private` |
|
|
43
|
+
| 4 | `arkts-unique-names` | ERROR | Yes | Type and namespace names must be unique |
|
|
44
|
+
| 5 | `arkts-no-var` | ERROR | Yes | Use `let`/`const` instead of `var` |
|
|
45
|
+
| 8 | `arkts-no-any-unknown` | ERROR | - | `any` and `unknown` are banned; use explicit types |
|
|
46
|
+
| 14 | `arkts-no-call-signatures` | ERROR | - | Replace call-signature types with `class` |
|
|
47
|
+
| 15 | `arkts-no-ctor-signatures-type` | ERROR | - | Replace constructor-signature types with `class` |
|
|
48
|
+
| 16 | `arkts-no-multiple-static-blocks` | ERROR | - | Only one `static` block per class |
|
|
49
|
+
| 17 | `arkts-no-indexed-signatures` | ERROR | - | Index signatures are not supported; use `Record<K,V>` or concrete types |
|
|
50
|
+
| 19 | `arkts-no-intersection-types` | ERROR | - | Intersection types `A & B` are not supported; use inheritance |
|
|
51
|
+
| 21 | `arkts-no-typing-with-this` | ERROR | - | `this` type annotations are not supported |
|
|
52
|
+
| 22 | `arkts-no-conditional-types` | ERROR | - | Conditional types `T extends U ? X : Y` are not supported |
|
|
53
|
+
| 25 | `arkts-no-ctor-prop-decls` | ERROR | Yes | Constructor parameter properties are not supported; declare fields in the class body |
|
|
54
|
+
| 27 | `arkts-no-ctor-signatures-iface` | ERROR | - | Constructor signatures are not supported in interfaces |
|
|
55
|
+
| 28 | `arkts-no-aliases-by-index` | ERROR | - | Indexed access types `T['prop']` are not supported |
|
|
56
|
+
| 29 | `arkts-no-props-by-index` | ERROR | Yes | Indexed field access is banned on plain objects (`Record` types excepted) |
|
|
57
|
+
| 30 | `arkts-no-structural-typing` | ERROR | - | Structural typing is not supported; use explicit inheritance/implementation |
|
|
58
|
+
| 34 | `arkts-no-inferred-generic-params` | ERROR | Yes | Type inference for generic calls is limited; annotate explicitly |
|
|
59
|
+
| 37 | `arkts-no-regexp-literals` | ERROR | - | Regex literals are not supported; use `new RegExp()` |
|
|
60
|
+
| 38 | `arkts-no-untyped-obj-literals` | ERROR | - | Object literals must correspond to an explicitly declared class/interface/Record |
|
|
61
|
+
| 40 | `arkts-no-obj-literals-as-types` | ERROR | - | Object literals cannot be used as type declarations; use `interface` |
|
|
62
|
+
| 43 | `arkts-no-noninferrable-arr-literals` | ERROR | - | Array literal element types must be inferrable |
|
|
63
|
+
| 46 | `arkts-no-func-expressions` | ERROR | Yes | Replace function expressions with arrow functions |
|
|
64
|
+
| 49 | `arkts-no-generic-lambdas` | ERROR | Yes | Replace generic arrow functions with generic function declarations |
|
|
65
|
+
| 50 | `arkts-no-class-literals` | ERROR | Yes | Class expressions are not supported; use named class declarations |
|
|
66
|
+
| 51 | `arkts-implements-only-iface` | ERROR | - | `implements` only accepts interfaces, not classes |
|
|
67
|
+
| 52 | `arkts-no-method-reassignment` | ERROR | - | Reassigning object methods is not supported |
|
|
68
|
+
| 53 | `arkts-as-casts` | ERROR | Yes | Type assertions support only `as T`; `<T>value` is banned |
|
|
69
|
+
| 54 | `arkts-no-jsx` | ERROR | - | JSX is not supported |
|
|
70
|
+
| 55 | `arkts-no-polymorphic-unops` | ERROR | - | Unary `+` `-` `~` work only on numbers |
|
|
71
|
+
| 59 | `arkts-no-delete` | ERROR | - | The `delete` operator is not supported |
|
|
72
|
+
| 60 | `arkts-no-type-query` | ERROR | - | `typeof` is allowed only in expression contexts |
|
|
73
|
+
| 65 | `arkts-instanceof-ref-types` | ERROR | - | `instanceof` supports only reference types (classes) |
|
|
74
|
+
| 66 | `arkts-no-in` | ERROR | - | The `in` operator is not supported |
|
|
75
|
+
| 69 | `arkts-no-destruct-assignment` | ERROR | Yes | Destructuring assignment is not supported |
|
|
76
|
+
| 71 | `arkts-no-comma-outside-loops` | ERROR | - | The comma operator is allowed only inside `for` loops |
|
|
77
|
+
| 74 | `arkts-no-destruct-decls` | ERROR | Yes | Destructuring variable declarations are not supported |
|
|
78
|
+
| 79 | `arkts-no-types-in-catch` | ERROR | Yes | `catch` clauses cannot carry type annotations |
|
|
79
|
+
| 80 | `arkts-no-for-in` | ERROR | - | `for...in` is not supported; use `for...of` |
|
|
80
|
+
| 83 | `arkts-no-mapped-types` | ERROR | - | Mapped types are not supported |
|
|
81
|
+
| 84 | `arkts-no-with` | ERROR | - | The `with` statement is not supported |
|
|
82
|
+
| 87 | `arkts-limited-throw` | ERROR | Yes | `throw` accepts only `Error` and its subclasses |
|
|
83
|
+
| 90 | `arkts-no-implicit-return-types` | ERROR | Yes | Function return type inference is limited; annotate explicitly |
|
|
84
|
+
| 91 | `arkts-no-destruct-params` | ERROR | - | Parameter destructuring is not supported |
|
|
85
|
+
| 92 | `arkts-no-nested-funcs` | ERROR | Yes | Nested function declarations are not supported; use arrow-function values or class methods |
|
|
86
|
+
| 93 | `arkts-no-standalone-this` | ERROR | - | `this` cannot be used in standalone functions |
|
|
87
|
+
| 94 | `arkts-no-generators` | ERROR | - | Generator functions and `yield` are not supported |
|
|
88
|
+
| 96 | `arkts-no-is` | ERROR | - | `is` type guards are not supported; use `instanceof`/`as` |
|
|
89
|
+
| 99 | `arkts-no-spread` | ERROR | - | Spread supports only arrays (and array-derived classes); object spread to arbitrary targets is not supported |
|
|
90
|
+
| 102 | `arkts-no-extend-same-prop` | ERROR | - | An interface cannot extend multiple interfaces with the same method |
|
|
91
|
+
| 103 | `arkts-no-decl-merging` | ERROR | - | Declaration merging is not supported |
|
|
92
|
+
| 104 | `arkts-extends-only-class` | ERROR | - | Interfaces cannot extend classes |
|
|
93
|
+
| 106 | `arkts-no-ctor-signatures-funcs` | ERROR | - | Constructor function types are not supported |
|
|
94
|
+
| 111 | `arkts-no-enum-mixed-types` | ERROR | - | Enum members can only be initialized with compile-time constants of the same type |
|
|
95
|
+
| 113 | `arkts-no-enum-merging` | ERROR | - | `enum` declaration merging is not supported |
|
|
96
|
+
| 114 | `arkts-no-ns-as-obj` | ERROR | - | Namespaces cannot be used as objects |
|
|
97
|
+
| 116 | `arkts-no-ns-statements` | ERROR | - | Non-declaration statements are not supported in namespaces |
|
|
98
|
+
| 118 | `arkts-no-special-imports` | ERROR | - | `import type` declarations are not supported |
|
|
99
|
+
| 119 | `arkts-no-side-effects-imports` | ERROR | - | Side-effect-only imports `import './module'` are not supported |
|
|
100
|
+
| 120 | `arkts-no-import-default-as` | ERROR | Yes | `import { default as x }` is not supported |
|
|
101
|
+
| 121 | `arkts-no-require` | ERROR | - | `require` and import assignment are not supported |
|
|
102
|
+
| 126 | `arkts-no-export-assignment` | ERROR | - | `export =` is not supported |
|
|
103
|
+
| 127 | `arkts-no-special-exports` | ERROR | - | `export type` declarations are not supported |
|
|
104
|
+
| 128 | `arkts-no-ambient-decls` | ERROR | - | Ambient module declarations are not supported |
|
|
105
|
+
| 129 | `arkts-no-module-wildcards` | ERROR | - | Wildcards in module names are not supported |
|
|
106
|
+
| 130 | `arkts-no-umd` | ERROR | - | UMD is not supported |
|
|
107
|
+
| 132 | `arkts-no-new-target` | ERROR | - | `new.target` is not supported |
|
|
108
|
+
| 134 | `arkts-no-definite-assignment` | WARNING | - | Definite assignment assertions `let x!: number` are not supported |
|
|
109
|
+
| 136 | `arkts-no-prototype-assignment` | ERROR | - | Prototype assignment is not supported |
|
|
110
|
+
| 137 | `arkts-no-globalthis` | ERROR | - | `globalThis` is not supported |
|
|
111
|
+
| 138 | `arkts-no-utility-types` | ERROR | - | Utility types: only Partial/Required/Readonly/Record are supported |
|
|
112
|
+
| 139 | `arkts-no-func-props` | ERROR | - | Declaring properties on functions is not supported |
|
|
113
|
+
| 140 | `arkts-no-func-bind` | ERROR | - | `Function.bind` is not supported |
|
|
114
|
+
| 142 | `arkts-no-as-const` | ERROR | - | `as const` assertions are not supported |
|
|
115
|
+
| 143 | `arkts-no-import-assertions` | ERROR | - | Import assertions are not supported |
|
|
116
|
+
| 144 | `arkts-limited-stdlib` | ERROR | - | Standard library APIs are restricted (see details) |
|
|
117
|
+
| 145 | `arkts-strict-typing` | ERROR | - | Strict type checking is enforced |
|
|
118
|
+
| 146 | `arkts-strict-typing-required` | ERROR | - | Suppressing type checks via comments (`@ts-ignore` etc.) is banned |
|
|
119
|
+
| 147 | `arkts-no-ts-deps` | ERROR | - | ArkTS modules cannot depend on TypeScript code |
|
|
120
|
+
| 148 | `arkts-no-decorators-except-arkui` | WARNING | - | Only ArkUI decorators are allowed |
|
|
121
|
+
| 149 | `arkts-no-classes-as-obj` | ERROR | - | Classes cannot be used as objects |
|
|
122
|
+
| 150 | `arkts-no-misplaced-imports` | ERROR | - | `import` must precede all other statements |
|
|
123
|
+
| 151 | `arkts-limited-esobj` | WARNING | - | `ESObject` is limited to JS interop scenarios |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Rule Details by Category
|
|
128
|
+
|
|
129
|
+
### 1. Type system
|
|
130
|
+
|
|
131
|
+
#### Rule 8: No `any` / `unknown` (`arkts-no-any-unknown`)
|
|
132
|
+
```ets
|
|
133
|
+
// ❌
|
|
134
|
+
let x: any;
|
|
135
|
+
const y: unknown = getValue();
|
|
136
|
+
// ✅
|
|
137
|
+
let x: string;
|
|
138
|
+
const y: string = getValue();
|
|
139
|
+
// ✅ When the type is genuinely undetermined, use Object or a concrete union type
|
|
140
|
+
function process(input: string | number): void {}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### Rule 19: Replace intersection types with inheritance (`arkts-no-intersection-types`)
|
|
144
|
+
```ets
|
|
145
|
+
// ❌
|
|
146
|
+
type Combined = TypeA & TypeB;
|
|
147
|
+
// ✅
|
|
148
|
+
interface Combined extends TypeA, TypeB {}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### Rule 17: Replace index signatures with `Record` (`arkts-no-indexed-signatures`)
|
|
152
|
+
```ets
|
|
153
|
+
// ❌
|
|
154
|
+
interface Conf { [key: string]: string }
|
|
155
|
+
function foo(data: { [key: string]: string }): void {}
|
|
156
|
+
// ✅ Official recommended rewrite
|
|
157
|
+
function foo(data: Record<string, string>): void {
|
|
158
|
+
data['a'] = 'a'; // indexed access on Record is allowed
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### Rules 22 / 83 / 28 / 21: Unsupported advanced types
|
|
163
|
+
```ets
|
|
164
|
+
type A<T> = T extends string ? string : number; // ❌ conditional type (22)
|
|
165
|
+
type B<T> = { readonly [P in keyof T]: T[P] }; // ❌ mapped type (83)
|
|
166
|
+
type C = SomeType['name']; // ❌ indexed access type (28)
|
|
167
|
+
type D = { getThis: () => this }; // ❌ this type annotation (21)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Rule 30: No structural typing (`arkts-no-structural-typing`)
|
|
171
|
+
ArkTS uses nominal typing: two types with identical structure but no inheritance/implementation relationship are not interchangeable.
|
|
172
|
+
```ets
|
|
173
|
+
interface Point { x: number; y: number }
|
|
174
|
+
interface Point2D { x: number; y: number }
|
|
175
|
+
function printPoint(p: Point): void {}
|
|
176
|
+
const p2: Point2D = { x: 1, y: 2 };
|
|
177
|
+
printPoint(p2); // ❌ same structure, incompatible types
|
|
178
|
+
// ✅ make Point2D extend Point, or just use Point
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### Rule 138: Only four utility types supported (`arkts-no-utility-types`)
|
|
182
|
+
Official wording: **only `Partial`, `Required`, `Readonly`, and `Record` are supported**.
|
|
183
|
+
- `Partial<T>`'s generic parameter T must be a class or interface
|
|
184
|
+
- Indexed access on `Record<K, V>` yields a result type that includes `undefined`
|
|
185
|
+
- All others (`Pick`, `Omit`, `Exclude`, `ReturnType`, `Awaited`, etc.) are **not supported**
|
|
186
|
+
|
|
187
|
+
#### Rules 34 / 90: Limited type inference — annotate explicitly
|
|
188
|
+
```ets
|
|
189
|
+
function identity<T>(value: T): T { return value }
|
|
190
|
+
const r = identity(42); // ❌ generic inference limited (34)
|
|
191
|
+
const r: number = identity<number>(42); // ✅
|
|
192
|
+
|
|
193
|
+
function add(a: number, b: number) { return a + b } // ❌ missing return type (90)
|
|
194
|
+
function add(a: number, b: number): number { return a + b } // ✅
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### Rules 4 / 103: Type names must be unique — across imports and across files (`arkts-unique-names`, `arkts-no-decl-merging`)
|
|
198
|
+
|
|
199
|
+
A local declaration must not reuse the name of anything imported by the same file. The high-frequency trap is a page struct named after the model type it displays:
|
|
200
|
+
```ets
|
|
201
|
+
// pages/FortuneResult.ets
|
|
202
|
+
import { FortuneResult } from '../model/BaziCalculator'; // ❌ arkts-unique-names +
|
|
203
|
+
@Entry @Component
|
|
204
|
+
struct FortuneResult { /* ... */ } // "Import declaration conflicts with local declaration"
|
|
205
|
+
// — and every `fortune.score` access then cascades into false "Property 'score' does not exist on type 'FortuneResult'"
|
|
206
|
+
|
|
207
|
+
// ✅ alias the import (or name the page XxxPage)
|
|
208
|
+
import { FortuneResult as FortuneData } from '../model/BaziCalculator';
|
|
209
|
+
@Entry @Component
|
|
210
|
+
struct FortuneResult {
|
|
211
|
+
@State fortune: FortuneData = new FortuneData();
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
The same name must not be declared in two files either — duplicating a shared interface per page fails:
|
|
216
|
+
```ets
|
|
217
|
+
// pages/Calculator.ets AND pages/Result.ets each declare:
|
|
218
|
+
interface ResultParams { taxAmount: string } // ❌ arkts-no-decl-merging in BOTH files
|
|
219
|
+
// ✅ declare ONCE in model/ResultParams.ets, export it, import in both pages
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 2. Object literals and property access
|
|
223
|
+
|
|
224
|
+
#### Rule 38: Object literals need an explicit type context (`arkts-no-untyped-obj-literals`)
|
|
225
|
+
```ets
|
|
226
|
+
// ❌
|
|
227
|
+
const obj = { name: "John", age: 30 };
|
|
228
|
+
// ✅ correspond to a class/interface
|
|
229
|
+
interface Person { name: string; age: number }
|
|
230
|
+
const obj: Person = { name: "John", age: 30 };
|
|
231
|
+
// ✅ or correspond to a Record
|
|
232
|
+
const dict: Record<string, string> = { 'a': 'x', 'b': 'y' };
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Record literals require quoted keys** — an unquoted identifier key triggers this same rule even though the literal has a type context (verified checker behavior):
|
|
236
|
+
```ets
|
|
237
|
+
const p: Record<string, string> = { pagePath: v }; // ❌ arkts-no-untyped-obj-literals — key not a string literal
|
|
238
|
+
const p: Record<string, string> = { 'pagePath': v }; // ✅
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Class-typed literals must list every field** — initializers/defaults in the class body do NOT make fields optional in a literal:
|
|
242
|
+
```ets
|
|
243
|
+
class Capsule {
|
|
244
|
+
id: string = '';
|
|
245
|
+
tags: string[] = [];
|
|
246
|
+
openedAt: number | undefined = undefined;
|
|
247
|
+
}
|
|
248
|
+
const c: Capsule = { id: '1' }; // ❌ Type '{ id: string; }' is missing the following properties from type 'Capsule': tags, openedAt
|
|
249
|
+
const c: Capsule = { id: '1', tags: [], openedAt: undefined }; // ✅ all fields listed, defaults repeated explicitly
|
|
250
|
+
```
|
|
251
|
+
For seed/mock data prefer a static factory so adding a field later means one change, not N literal fixes (see cookbook § Creating instances with data).
|
|
252
|
+
|
|
253
|
+
#### Rule 40: Object literals cannot be type declarations (`arkts-no-obj-literals-as-types`)
|
|
254
|
+
```ets
|
|
255
|
+
type MyType = { name: string }; // ❌
|
|
256
|
+
function f(p: { x: number; y: number }): void {} // ❌ inline object type
|
|
257
|
+
// ✅
|
|
258
|
+
interface MyType { name: string }
|
|
259
|
+
function f(p: MyType): void {}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
#### Rule 29: No indexed access on plain objects (`arkts-no-props-by-index`)
|
|
263
|
+
```ets
|
|
264
|
+
class Point { x: number = 0; y: number = 0 }
|
|
265
|
+
const p = new Point();
|
|
266
|
+
const v = p['x']; // ❌ no indexed access on class instances
|
|
267
|
+
const v = p.x; // ✅ dot access
|
|
268
|
+
// ✅ Exception: Record types allow indexed access
|
|
269
|
+
const rec: Record<string, number> = { 'x': 1 };
|
|
270
|
+
const n: number | undefined = rec['x'];
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### Rule 1: Property names must be identifiers or string literals (`arkts-identifiers-as-prop-names`)
|
|
274
|
+
```ets
|
|
275
|
+
const a = { 1: 'one' }; // ❌ numeric property name
|
|
276
|
+
const b = { name: 'ok' }; // ✅
|
|
277
|
+
const c: Record<string, string> = { 'key-with-dash': 'ok' }; // ✅ string literal
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### Rule 43: Array literal types must be inferrable (`arkts-no-noninferrable-arr-literals`)
|
|
281
|
+
```ets
|
|
282
|
+
const arr = [new A(), new B()]; // ❌ mixed types without context
|
|
283
|
+
const arr: Base[] = [new A(), new B()]; // ✅
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
#### Rules 52 / 136 / 139: No runtime mutation of object structure
|
|
287
|
+
```ets
|
|
288
|
+
obj.method = () => {}; // ❌ method reassignment (52)
|
|
289
|
+
MyClass.prototype.newMethod = () => {}; // ❌ prototype assignment (136)
|
|
290
|
+
myFunction.customProp = 'value'; // ❌ properties on functions (139)
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### 3. Functions
|
|
294
|
+
|
|
295
|
+
#### Rule 46: Replace function expressions with arrow functions (`arkts-no-func-expressions`)
|
|
296
|
+
```ets
|
|
297
|
+
const fn = function(x: number): number { return x * 2 }; // ❌
|
|
298
|
+
const fn = (x: number): number => { return x * 2 }; // ✅
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### Rule 92: No nested function declarations (`arkts-no-nested-funcs`)
|
|
302
|
+
```ets
|
|
303
|
+
// ❌
|
|
304
|
+
function outer(): void {
|
|
305
|
+
function inner(): void {} // nested function declaration
|
|
306
|
+
inner();
|
|
307
|
+
}
|
|
308
|
+
// ✅ Option 1: arrow-function value inside the function
|
|
309
|
+
function outer(): void {
|
|
310
|
+
const inner = (): void => {};
|
|
311
|
+
inner();
|
|
312
|
+
}
|
|
313
|
+
// ✅ Option 2: promote to a top-level function or class method
|
|
314
|
+
function inner(): void {}
|
|
315
|
+
function outer(): void { inner() }
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
#### Rule 93: No `this` in standalone functions (`arkts-no-standalone-this`)
|
|
319
|
+
|
|
320
|
+
Applies to standalone functions AND `static` methods — a static method body is treated as standalone, so `this` referring to the class is flagged.
|
|
321
|
+
|
|
322
|
+
```ets
|
|
323
|
+
function fn(): void { console.log(this.value) } // ❌ standalone function
|
|
324
|
+
|
|
325
|
+
class Store {
|
|
326
|
+
static items: string[] = [];
|
|
327
|
+
static add(x: string): void { this.items.push(x) } // ❌ `this` in a static method — same error
|
|
328
|
+
static addOk(x: string): void { Store.items.push(x) } // ✅ reference statics via the class name
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// ✅ instance methods may use this
|
|
332
|
+
class MyClass {
|
|
333
|
+
value: number = 10;
|
|
334
|
+
fn(): void { console.log(this.value) }
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
A data-store class with `static` state + `static` helpers (a common pattern) must use the class name in every helper body — one `this.` written there and copy-pasted across helpers multiplies into one error per method.
|
|
339
|
+
|
|
340
|
+
#### Rule 49: Replace generic arrow functions with generic function declarations (`arkts-no-generic-lambdas`)
|
|
341
|
+
```ets
|
|
342
|
+
const identity = <T>(value: T): T => value; // ❌
|
|
343
|
+
function identity<T>(value: T): T { return value } // ✅
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
#### Rules 94 / 140 / 132: Other function restrictions
|
|
347
|
+
```ets
|
|
348
|
+
function* gen() { yield 1 } // ❌ generators (94)
|
|
349
|
+
const bound = fn.bind(null, 'Hi'); // ❌ Function.bind (140)
|
|
350
|
+
new.target // ❌ (132)
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### 4. Classes and interfaces
|
|
354
|
+
|
|
355
|
+
#### Rule 25: Declare fields in the class body (`arkts-no-ctor-prop-decls`)
|
|
356
|
+
```ets
|
|
357
|
+
// ❌ constructor parameter properties
|
|
358
|
+
class MyClass {
|
|
359
|
+
constructor(public name: string, private age: number) {}
|
|
360
|
+
}
|
|
361
|
+
// ✅
|
|
362
|
+
class MyClass {
|
|
363
|
+
public name: string;
|
|
364
|
+
private age: number;
|
|
365
|
+
constructor(name: string, age: number) {
|
|
366
|
+
this.name = name;
|
|
367
|
+
this.age = age;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
#### Rules 51 / 104: Direction restrictions on inheritance and implementation
|
|
373
|
+
```ets
|
|
374
|
+
class Base {}
|
|
375
|
+
class D1 implements Base {} // ❌ implements only accepts interfaces (51)
|
|
376
|
+
interface I1 extends Base {} // ❌ interfaces cannot extend classes (104)
|
|
377
|
+
class D2 extends Base {} // ✅
|
|
378
|
+
interface IBase {}
|
|
379
|
+
class D3 implements IBase {} // ✅
|
|
380
|
+
interface I2 extends IBase {} // ✅
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
#### Rule 149: Classes cannot be used as objects (`arkts-no-classes-as-obj`)
|
|
384
|
+
```ets
|
|
385
|
+
class MyClass { static prop: number = 10 }
|
|
386
|
+
const obj = MyClass; // ❌ passing a class as a value
|
|
387
|
+
MyClass.newProp = 20; // ❌ attaching static properties at runtime
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
#### Rules 3 / 16 / 50: Other class restrictions
|
|
391
|
+
```ets
|
|
392
|
+
class A { #priv: number = 0 } // ❌ # private fields; use private (3)
|
|
393
|
+
class B { static {} static {} } // ❌ multiple static blocks (16)
|
|
394
|
+
const C = class { }; // ❌ class expressions (50)
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
#### Rules 14 / 15 / 27 / 106: Call/constructor signature types — always rewrite to class
|
|
398
|
+
```ets
|
|
399
|
+
type Callable = { (x: number): string }; // ❌ (14)
|
|
400
|
+
type Ctor = { new (name: string): MyClass }; // ❌ (15)
|
|
401
|
+
interface I { new (name: string): I } // ❌ (27)
|
|
402
|
+
type F = Function & { new (s: string): Object }; // ❌ (106)
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
#### Rules 102 / 103 / 113: Declaration-merging restrictions
|
|
406
|
+
```ets
|
|
407
|
+
interface A { p1: string }
|
|
408
|
+
interface A { p2: number } // ❌ interface declaration merging (103)
|
|
409
|
+
enum E { A }
|
|
410
|
+
enum E { B = 1 } // ❌ enum declaration merging (113)
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
#### Rule 111: Enum member initialization restrictions (`arkts-no-enum-mixed-types`)
|
|
414
|
+
```ets
|
|
415
|
+
enum Mixed { A = 1, B = "s" } // ❌ mixed types
|
|
416
|
+
enum Num { A = 1, B = 2 } // ✅ all number
|
|
417
|
+
enum Str { A = "one", B = "two" } // ✅ all string
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### 5. Expressions and statements
|
|
421
|
+
|
|
422
|
+
#### Rule 53: Assertions support only `as T` (`arkts-as-casts`)
|
|
423
|
+
```ets
|
|
424
|
+
const s = <string>value; // ❌ angle-bracket assertion
|
|
425
|
+
const s = value as string; // ✅ as is the only supported assertion syntax
|
|
426
|
+
```
|
|
427
|
+
Note: `as` itself is legal and idiomatic; do not avoid it out of TypeScript habit.
|
|
428
|
+
|
|
429
|
+
#### Rule 59: No `delete` (`arkts-no-delete`)
|
|
430
|
+
```ets
|
|
431
|
+
delete obj.property; // ❌
|
|
432
|
+
// ✅ declare the field type as optional/including undefined, then set undefined
|
|
433
|
+
obj.property = undefined;
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
#### Rules 66 / 80: No `in` and `for...in`
|
|
437
|
+
```ets
|
|
438
|
+
if ('name' in obj) {} // ❌ (66)
|
|
439
|
+
for (const k in obj) {} // ❌ (80)
|
|
440
|
+
// ✅ alternatives
|
|
441
|
+
if (obj.name !== undefined) {} // property presence
|
|
442
|
+
if (obj instanceof Person) {} // type check
|
|
443
|
+
for (const item of array) {} // array iteration
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
#### Rules 69 / 74 / 91: No destructuring of any form
|
|
447
|
+
```ets
|
|
448
|
+
const { a, b } = obj; // ❌ destructuring declaration (74)
|
|
449
|
+
[x, y] = [y, x]; // ❌ destructuring assignment (69)
|
|
450
|
+
function greet({ name }: Person): void {} // ❌ parameter destructuring (91)
|
|
451
|
+
// ✅ access each property explicitly
|
|
452
|
+
const a = obj.a;
|
|
453
|
+
const b = obj.b;
|
|
454
|
+
function greet(person: Person): void { console.log(person.name) }
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
#### Rule 87: `throw` only accepts Error (`arkts-limited-throw`)
|
|
458
|
+
```ets
|
|
459
|
+
throw "error message"; // ❌
|
|
460
|
+
throw 42; // ❌
|
|
461
|
+
throw new Error("message"); // ✅
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
#### Rule 79: `catch` cannot carry a type annotation (`arkts-no-types-in-catch`)
|
|
465
|
+
```ets
|
|
466
|
+
try {} catch (e: Error) {} // ❌
|
|
467
|
+
try {} catch (e) { // ✅ narrow with as inside
|
|
468
|
+
const err = e as Error;
|
|
469
|
+
console.log(err.message);
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
#### Rule 96: No `is` type guards (`arkts-no-is`)
|
|
474
|
+
```ets
|
|
475
|
+
function isCat(a: Animal): a is Cat { ... } // ❌
|
|
476
|
+
// ✅ use instanceof + as
|
|
477
|
+
if (animal instanceof Cat) {
|
|
478
|
+
const cat = animal as Cat;
|
|
479
|
+
}
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
#### Rule 99: Spread supports only arrays (`arkts-no-spread`)
|
|
483
|
+
```ets
|
|
484
|
+
const merged = { ...obj1, ...obj2 }; // ❌ object spread into object literals is restricted
|
|
485
|
+
fn(...someObj); // ❌
|
|
486
|
+
const arr = [...arr1, ...arr2]; // ✅ array spread
|
|
487
|
+
fn(...numArray); // ✅ spreading an array into rest parameters
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
#### Rules 55 / 60 / 65 / 71 / 84: Operator restrictions
|
|
491
|
+
```ets
|
|
492
|
+
const n = +"42"; // ❌ unary +/-/~ only on numbers (55)
|
|
493
|
+
type T = typeof someVar; // ❌ typeof not allowed in type context (60)
|
|
494
|
+
const t = typeof someVar; // ✅ expression context is fine
|
|
495
|
+
v instanceof MyInterface // ❌ instanceof not for interfaces/primitives (65)
|
|
496
|
+
v instanceof MyClass // ✅
|
|
497
|
+
const x = (a, b, c); // ❌ comma operator outside for loops (71)
|
|
498
|
+
with (obj) {} // ❌ (84)
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
#### Rule 37: Regex literals (`arkts-no-regexp-literals`)
|
|
502
|
+
```ets
|
|
503
|
+
const re = /test/g; // ❌
|
|
504
|
+
const re = new RegExp("test", "g"); // ✅
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### 6. Standard library restrictions (Rule 144 `arkts-limited-stdlib`)
|
|
508
|
+
|
|
509
|
+
Banned global functions: `eval`
|
|
510
|
+
|
|
511
|
+
Banned `Object` static/prototype methods (all unavailable):
|
|
512
|
+
`__proto__`, `assign`, `create`, `defineProperty`, `defineProperties`, `freeze`, `seal`,
|
|
513
|
+
`fromEntries`, `getOwnPropertyDescriptor(s)`, `getOwnPropertySymbols`, `getPrototypeOf`, `setPrototypeOf`,
|
|
514
|
+
`hasOwnProperty`, `is`, `isExtensible`, `isFrozen`, `isPrototypeOf`, `isSealed`, `preventExtensions`, `propertyIsEnumerable`
|
|
515
|
+
|
|
516
|
+
`Reflect`/`Proxy` metaprogramming APIs are likewise banned. `Symbol` allows only `Symbol.iterator`.
|
|
517
|
+
|
|
518
|
+
Common replacements:
|
|
519
|
+
```ets
|
|
520
|
+
Object.assign(target, src) // ❌ → assign fields explicitly, or use a constructor
|
|
521
|
+
Object.keys(obj) // note: keys/values/entries are available, but prefer named types
|
|
522
|
+
obj.hasOwnProperty('k') // ❌ → obj.k !== undefined
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
#### Rules 137 / 146: Global object and check suppression
|
|
526
|
+
```ets
|
|
527
|
+
globalThis.someValue = 10; // ❌ (137) use an explicitly exported singleton / AppStorage
|
|
528
|
+
// @ts-ignore / @ts-nocheck // ❌ (146) comment-based type-check suppression is banned
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### 7. Module imports and exports
|
|
532
|
+
|
|
533
|
+
```ets
|
|
534
|
+
import { Something } from './m'; // ✅ standard named import
|
|
535
|
+
import myDefault from './m'; // ✅ default import
|
|
536
|
+
import * as ns from './m'; // ✅ namespace import
|
|
537
|
+
|
|
538
|
+
import type { T } from './m'; // ❌ (118)
|
|
539
|
+
import './module'; // ❌ side-effect-only import (119)
|
|
540
|
+
import { default as x } from './m'; // ❌ (120)
|
|
541
|
+
import x = require('m'); // ❌ (121)
|
|
542
|
+
export = MyClass; // ❌ (126)
|
|
543
|
+
export type { T } from './m'; // ❌ (127)
|
|
544
|
+
declare module "lib" {} // ❌ (128)
|
|
545
|
+
|
|
546
|
+
// imports must precede all other statements (150)
|
|
547
|
+
const x = 1;
|
|
548
|
+
import { A } from './m'; // ❌
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### 8. Namespaces
|
|
552
|
+
|
|
553
|
+
```ets
|
|
554
|
+
namespace MyNS {
|
|
555
|
+
export const value = 10; // ✅ declarations only
|
|
556
|
+
console.log(value); // ❌ non-declaration statement (116)
|
|
557
|
+
}
|
|
558
|
+
const ns = MyNS; // ❌ namespace used as a value (114)
|
|
559
|
+
MyNS.doWork(); // ✅ calling its exported members directly is allowed
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### 9. Decorators and ArkUI (Rule 148 `arkts-no-decorators-except-arkui`)
|
|
563
|
+
|
|
564
|
+
Only ArkUI decorators are allowed:
|
|
565
|
+
`@AnimatableExtend` `@Builder` `@BuilderParam` `@Component` `@Concurrent` `@Consume` `@CustomDialog` `@Entry` `@Extend` `@Link` `@LocalStorageLink` `@LocalStorageProp` `@ObjectLink` `@Observed` `@Preview` `@Prop` `@Provide` `@Reusable` `@State` `@StorageLink` `@StorageProp` `@Styles` `@Watch` `@Require` `@Track` — and the V2 family `@ComponentV2` `@Local` `@Param` `@Once` `@Event` `@Provider` `@Consumer` `@Monitor` `@Computed` `@ObservedV2` `@Trace` `@Type` (plus concurrency decorators such as @Sendable)
|
|
566
|
+
|
|
567
|
+
```ets
|
|
568
|
+
@Component
|
|
569
|
+
struct MyComponent {
|
|
570
|
+
@State count: number = 0;
|
|
571
|
+
@Prop message: string = '';
|
|
572
|
+
|
|
573
|
+
build() {
|
|
574
|
+
Text(`${this.message}, count: ${this.count}`) // ✅ template literals are legal
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
Custom decorators (e.g. `@MyDecorator`) are not allowed.
|
|
580
|
+
|
|
581
|
+
### 10. Sendable concurrency restrictions
|
|
582
|
+
|
|
583
|
+
`@Sendable` classes are used to pass data across concurrent instances and carry extra restrictions:
|
|
584
|
+
|
|
585
|
+
| Rule Tag | Restriction |
|
|
586
|
+
|----------|-------------|
|
|
587
|
+
| `arkts-sendable-class-decorator` | Sendable classes must be annotated with `@Sendable` |
|
|
588
|
+
| `arkts-sendable-explicit-field-type` | Fields must have explicit type annotations |
|
|
589
|
+
| `arkts-sendable-prop-types` | Field types must themselves be sendable (primitives, Sendable classes, collections containers, etc.) |
|
|
590
|
+
| `arkts-sendable-obj-init` | Sendable types cannot be initialized directly from object/array literals |
|
|
591
|
+
| `arkts-sendable-definite-assignment` | Definite assignment assertions `!` are banned in Sendable classes |
|
|
592
|
+
| `arkts-sendable-imported-variables` | Capturing outer variables in Sendable classes/functions is restricted; only sendable top-level exports may be referenced |
|
|
593
|
+
| `arkts-sendable-class-inheritance` | Sendable classes can only extend Sendable classes; non-Sendable classes cannot extend Sendable classes |
|
|
594
|
+
|
|
595
|
+
```ets
|
|
596
|
+
@Sendable
|
|
597
|
+
class SharedData {
|
|
598
|
+
count: number = 0; // ✅ explicit type + primitive
|
|
599
|
+
items: collections.Array<string> = new collections.Array<string>(); // ✅
|
|
600
|
+
// obj: Record<string, string> = {}; // ❌ non-sendable field type
|
|
601
|
+
}
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
### 11. ESObject (Rule 151 `arkts-limited-esobj`)
|
|
605
|
+
|
|
606
|
+
`ESObject` is only for boundary code interoperating with JS/TS; avoid it in pure ArkTS code.
|
|
607
|
+
|
|
608
|
+
---
|
|
609
|
+
|
|
610
|
+
## Project conventions (NOT official linter rules)
|
|
611
|
+
|
|
612
|
+
The following are coding conventions of this project, **not ArkTS language restrictions**. When citing them, state that they are project conventions:
|
|
613
|
+
|
|
614
|
+
> Note: quoted keys in Record literals are **checker-enforced** (unquoted keys fail with `arkts-no-untyped-obj-literals`), so they live in Rule 38 above rather than as a project convention.
|
|
615
|
+
|
|
616
|
+
### Convention 1: Prefer `undefined` over `null`
|
|
617
|
+
`undefined` is more compatible with the ArkTS type system; when an external API may return `null`, convert with `?? undefined`:
|
|
618
|
+
```ets
|
|
619
|
+
const value: string | undefined = externalApi.getValue() ?? undefined;
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### Convention 2: A `Map` cannot be assigned directly to a `Record`
|
|
623
|
+
```ets
|
|
624
|
+
const cardInfo: Record<string, Object> = new Map<string, string>(); // ❌ type mismatch
|
|
625
|
+
// ✅ convert by iterating
|
|
626
|
+
const cardInfo: Record<string, Object> = {};
|
|
627
|
+
ocrResult.forEach((value: string, key: string) => {
|
|
628
|
+
cardInfo[key] = value as Object;
|
|
629
|
+
});
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
---
|
|
633
|
+
|
|
634
|
+
## Quick reference: most common errors
|
|
635
|
+
|
|
636
|
+
| Error / scenario | Solution |
|
|
637
|
+
|------------------|----------|
|
|
638
|
+
| `Object.assign is not supported` | Assign fields explicitly or use a constructor |
|
|
639
|
+
| `Destructuring is not supported` | Access each property explicitly |
|
|
640
|
+
| `Nested functions are not supported` | Use arrow-function values inside functions, or promote to class methods / top-level functions |
|
|
641
|
+
| `any/unknown is not supported` | Explicit types; when truly undetermined use `Object` or a union type |
|
|
642
|
+
| `Object literal must correspond to ...` | Declare an interface/class/Record type for the literal; if it already has a `Record` type, quote the keys |
|
|
643
|
+
| `... is missing the following properties from type` | Literal assigned to a class type must list every field — class-body defaults don't make fields optional (cookbook § Creating instances with data) |
|
|
644
|
+
| `Import declaration conflicts with local declaration` | Struct/class named after an import — alias the import (`import { X as XData }`) or rename the struct (Rule 4) |
|
|
645
|
+
| `Declaration merging is not supported` | Same interface declared in two files — declare once in a shared model file and import (Rule 103) |
|
|
646
|
+
| `Indexed access is not supported` | Switch to dot access; for dynamic keys declare the type as `Record<K,V>` |
|
|
647
|
+
| `is not supported (delete)` | Add `\| undefined` to the field type and set `undefined` |
|
|
648
|
+
| `for..in is not supported` | Use `for..of` for arrays; for object iteration use `Record` + a known key list, or `Map` |
|
|
649
|
+
| `Structural typing is not supported` | Establish an explicit `extends`/`implements` relationship |
|
|
650
|
+
| `Use explicit types instead of ...` (generic calls) | Spell out the generic argument or the variable type |
|