我增加了tsconfig.json个属性
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
为了能够导入npm包import * as ms from "ms";
但我还是犯了这个错误
This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
我错过了什么?
Update:
如果我改为import ms from "ms"
,那么编译器可以正常工作,但VSCode linter不能,错误是
can only be default-imported using the 'allowSyntheticDefaultImports' flagts(1259)
index.d.ts(25, 1): This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
正如我所说,现在正在工作,但VSCode有一个问题.