Hi there. I want to setup some pipelines to quality check the code. And I have found strange thing.
I wasn’t able to compile typescript with npx tsc --noEmit
How to reproduce:
- Install Cocos Creator 3.8.1 or 3.8.0
- Create a new project from ‘Hello World’ template.
- Open project folder in editor like VSCode
- In terminal add typescript to your project
npm i typescript
- Launch
npx tsc --noEmit
You will receive huge amount of errors like that:
C:/ProgramData/cocos/editors/Creator/3.8.1/resources/resources/3d/engine/@types/jsb.d.ts:205:18 - error TS2304: Cannot find name 'TypedArray'.
205 _data(): TypedArray;
~~~~~~~~~~
C:/ProgramData/cocos/editors/Creator/3.8.1/resources/resources/3d/engine/@types/jsb.d.ts:206:17 - error TS2304: Cannot find name 'TypedArray'.
206 __data: TypedArray;
~~~~~~~~~~
C:/ProgramData/cocos/editors/Creator/3.8.1/resources/resources/3d/engine/bin/.declarations/cc.d.ts:5767:9 - error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.
5767 [getEmbeddedPlayersTag](): Iterable<EmbeddedPlayer>;
..........
C:/ProgramData/cocos/editors/Creator/3.8.1/resources/resources/3d/engine/bin/.declarations/cc.d.ts:69141:155 - error TS2307: Cannot find module 'cc/editor/embedded-player' or its corresponding type declarations.
69141 import { EmbeddedPlayer, embeddedPlayerCountTag, getEmbeddedPlayersTag, addEmbeddedPlayerTag, removeEmbeddedPlayerTag, clearEmbeddedPlayersTag } from "cc/editor/embedded-player";
~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/ProgramData/cocos/editors/Creator/3.8.1/resources/resources/3d/engine/bin/.declarations/cc.d.ts:69142:60 - error TS2307: Cannot find module 'cc/editor/new-gen-anim' or its corresponding type declarations.
69142 import { AnimationMask, __private as ___private } from "cc/editor/new-gen-anim";
~~~~~~~~~~~~~~~~~~~~~~~~
C:/ProgramData/cocos/editors/Creator/3.8.1/resources/resources/3d/engine/bin/.declarations/cc.d.ts:69143:26 - error TS2307: Cannot find module 'cc/editor/serialization' or its corresponding type declarations.
69143 import { CCON } from "cc/editor/serialization";
Found 44 errors in 2 files.
Errors Files
2 C:/ProgramData/cocos/editors/Creator/3.8.1/resources/resources/3d/engine/@types/jsb.d.ts:205
42 C:/ProgramData/cocos/editors/Creator/3.8.1/resources/resources/3d/engine/bin/.declarations/cc.d.ts:5767
Expected behavoiur: no compillation errors.
I will be grateful for recommendations how to solve this.