ビルド時
TS2564: Property '...' has no initializer and is not definitely assigned in the constructor.
tsconfig.json
のstrictPropertyInitialization
をfalse
にするか、対象ファイルのプロパティ型宣言部分をfoo!: string
のように!
を付ける。
TS2339: Property 'includes' does not exist on type '...'
tsconfig.json
のlib
にes7
を含める。
TS2339: Property 'entries' does not exist on type '...'
tsconfig.json
のlib
にesnext
を含める。
import {...} from 'microrouter'; SyntaxError: Unexpected token {
commonjs
での実行が必要な部分にesnext
を使っている可能性があります。compilerOptions.module
がcommonjs
になってないならそれかもしれません。
'this' implicitly has type 'any' because it does not have a type annotation.
function
のthis
の型を指定してあげる。
function foo(this: Foo) {
/*...*/
}
Duplicate identifier '...'
tsconfig.json
のcompilerOptions.types
を使っているパッケージだけにする。
直接使っている型なら、node_modules
の削除とyarn cache clean
、またモノレポであればその型パッケージバージョンをすべてのワークスペースで統一するなど。
jest
Cannot find name 'test'. Do you need to install type definitions for a test runner? Try npm i @types/jest
or npm i @types/mocha
and then add jest
or mocha
to the types field in your tsconfig.ts(2593)
compilerOptions.typeRoots
やcompilerOptions.types
が変なことになっていないか確認する。上のDuplicate identifier '...'
の対応でjest
を含めていないなど。