Cocos TS Compile Check Sop

Cocos Creator TS Compile Check SOP

chrislamdev 77c2d72 971 B Updated

File contents

Cocos Creator TS Compile Check SOP

Mandatory TypeScript compile check before committing code to a Cocos Creator 3.x project.

Command

npx tsc --noEmit

Must pass with zero errors before any commit.

Common Errors & Fixes

Error Fix
Cannot find module 'cc' Add @cocos/creator-types to tsconfig
Property 'xxx' does not exist Check Cocos API version compatibility
Type 'X' is not assignable Check Cocos 3.x type differences from 2.x

tsconfig.json Checklist

  • compilerOptions.target: "ES2015" or higher
  • compilerOptions.module: "commonjs" or "ES2015"
  • compilerOptions.strict: true recommended
  • compilerOptions.skipLibCheck: true for faster checks
  • include: covers all assets/**/*.ts

See references/tsconfig-template.md for a complete working tsconfig.json.

chrislamdev/cocos-creator-debug-skills/tree/main/skills/cocos-ts-compile-check-sop commit 77c2d7211e

Frequently asked questions

npx skillmds@latest add chrislamdev/cocos-ts-compile-check-sop