标签: ts-migrate

错误 TS2578:未使用的“@ts-expect-error”指令

上周我曾经ts-migrate将我们的代码库迁移到 TypeScript。该工具在 TS 文件中添加了大量// @ts-expect-error注释,以使其通过 TS 编译器和类型检查。然而,当我运行yarn run tsc类型检查我的代码库时,我收到 5k+ 错误,指出error TS2578: Unused '@ts-expect-error' directive.我是否缺少一段配置,说明这些类型的错误没问题?寻求任何建议以使其通过 TS 编译器。

这是我的 TS 配置供参考。

{
    "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, …
Run Code Online (Sandbox Code Playgroud)

typescript ts-migrate

25
推荐指数
1
解决办法
3万
查看次数

标签 统计

ts-migrate ×1

typescript ×1