Last week I used ts-migrate
to migrate our codebase to TypeScript. The tool adds a lot of // @ts-expect-error
comments in TS files to get it to pass the TS compiler and type checking. However, when I run yarn run tsc
to type check my codebase I get 5k+ errors stating error TS2578: Unused '@ts-expect-error' directive.
Am I missing a piece of config stating that these types of errors are okay? Looking for any advice to get this to pass TS compiler.
Here is my TS config for reference.
{
"compilerOptions": {
"target": "ES2016",
"module": "commonjs",
"lib": ["esnext", "dom"],
"allowJs": true,
"checkJs": false,
"jsx": "react",
"declaration": false,
"declarationMap": false,
"sourceMap": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"noEmit": true,
"isolatedModules": true,
"strict": false,
"noImplicitAny": false,
"strictNullChecks": false,
"strictFunctionTypes": false,
"strictBindCallApply": false,
"strictPropertyInitialization": false,
"noImplicitThis": false,
"alwaysStrict": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,
"baseUrl": "./",
"typeRoots": [
"./types/",
"./node_modules/@types"
],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
}
}
Full example error message:
src/WorkspacePicker/__tests__/index.test.tsx:27:1 - error TS2578: Unused '@ts-expect-error' directive.
27 // @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'describe'. Do you need to instal... Remove this comment to see the full error message
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/WorkspacePicker/__tests__/index.test.tsx:29:3 - error TS2578: Unused '@ts-expect-error' directive.
29 // @ts-expect-error ts-migrate(2582) FIXME: Cannot find name 'test'. Do you need to install ty... Remove this comment to see the full error message
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/WorkspacePicker/__tests__/index.test.tsx:38:5 - error TS2578: Unused '@ts-expect-error' directive.
38 // @ts-expect-error ts-migrate(2304) FIXME: Cannot find name 'expect'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…