関連

ビルド時

TS2564: Property '...' has no initializer and is not definitely assigned in the constructor.

tsconfig.jsonstrictPropertyInitializationfalseにするか、対象ファイルのプロパティ型宣言部分をfoo!: stringのように!を付ける。

TS2339: Property 'includes' does not exist on type '...'

tsconfig.jsonlibes7を含める。

TS2339: Property 'entries' does not exist on type '...'

tsconfig.jsonlibesnextを含める。

import {...} from 'microrouter'; SyntaxError: Unexpected token {

commonjsでの実行が必要な部分にesnextを使っている可能性があります。compilerOptions.modulecommonjsになってないならそれかもしれません。

'this' implicitly has type 'any' because it does not have a type annotation.

functionthisの型を指定してあげる。

function foo(this: Foo) {
  /*...*/
}

Duplicate identifier '...'

tsconfig.jsoncompilerOptions.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.typeRootscompilerOptions.typesが変なことになっていないか確認する。上のDuplicate identifier '...'の対応でjestを含めていないなど。

JavaScript で飯食べたい歴約 5 年、 純( nju33 ) によるノートサイトです。

このサイトではドリンク代や奨学金返済の為、広告などを貼らせて頂いてますがご了承ください。

Change Log