visual-studio-code - VS Code 路径自动完成到操作系统的根目录
问题描述
我在 Visual Studio Code 中的 ts 项目显示了这条路径:~/
以及它对 macos 根目录的建议,如屏幕截图所示。
发生了什么事?
我的 tsconfig:
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"strict": true,
"jsx": "react",
"rootDir": "./",
"baseUrl": "./src",
"paths": {
"~*": ["./*"]
},
"incremental": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"lib": ["dom", "es2015", "webworker"]
}
}
解决方案
好的,找到了。
在 tsconfig 中应该是:
"paths": {
"~/*": ["./*"]
},
代替
"paths": {
"~*": ["./*"]
},