javascript中缺少typescript声明文件
我的项目混合了javascript和typescript文件。这是我的tsconfig.json文件:javascript中缺少typescript声明文件,javascript,typescript,visual-studio-code,Javascript,Typescript,Visual Studio Code,我的项目混合了javascript和typescript文件。这是我的tsconfig.json文件: "compilerOptions": { "target": "es2017", "baseUrl": ".", "checkJs": false, "allowJs": true, "noImplicitAny": true, "strictNullChecks": true, "experimentalDecorators": true, "jsx": "
"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):
这些错误在import语句下显示为3点,不会添加到vscode问题面板中的错误计数
屏幕截图:如果要导入这些JS文件,请在导入行之前使用
/@ts ignore
注释。TS编译器将跳过下一行的错误检查
//@ts-ignore
import * as something from 'file1';
我不想忽视这些错误。实际上,我正在试图理解为什么首先会出现这些错误。@Itainam您需要有一个类型声明,以便javascript模块不会出现这些错误。您可以在这里阅读=>
//@ts-ignore
import * as something from 'file1';