我的项目是混合的javascript和打字稿文件。那是我的tsconfig.json文件:
"compilerOptions": {
"target": "es2017",
"baseUrl": ".",
"checkJs": false,
"allowJs": true,
"noImplicitAny": true,
"strictNullChecks": true,
"experimentalDecorators": true,
"jsx": "react",
"esModuleInterop": true,
"isolatedModules": false,
"noEmit": true,
"moduleResolution": "node",
"skipLibCheck": true,
}
我一直在我的javascript文件中(checkJs设置为false):
Could not find a declaration file for module 'file1'. 'file1.js' implicitly has an 'any' type.ts(7016)
这些错误在import语句下显示为3个点,并且不会在vscode问题面板中添加错误计数。
如果要导入这些JS文件,请在导入行之前使用// @ts-ignore
注释。 TS编译器将跳过下一行的错误检查。
//@ts-ignore
import * as something from 'file1';