当模块在那里时,VS Code为什么会抛出“找不到模块'typescript'.ts(2307)”?

时间:2020-04-24 16:16:11

标签: node.js typescript visual-studio-code node-modules

我正在使用<LinearGradient colors={['#4c669f', '#3b5998', '#192f6a']}> <Text> Your Text Here </Text> </LinearGradient>将.type文件中的打字稿导入。

文件运行正常,但是VS Code告诉我import * as ts from "typescript";

有什么办法可以解决这个问题?

编辑:文件可以编译并成功运行

1 个答案:

答案 0 :(得分:1)

您要在VS Code的settings.json中更改这两个设置:

"typescript.validate.enable": false,
"javascript.validate.enable": false,

Source