Visual Studio Typescript Intellisense不尊重tsconfig.json baseUrl

Bri*_*van 8 visual-studio typescript

我在Visual Studio 2017中有一个带有大型TypeScript代码库的Web项目.当我进行TypeScript构建时,我没有错误,并且生成的JavaScript是正确的.但是,我的intellisense使用基于baseUrl我的tsconfig.json中配置的路径显示任何导入的错误.

例如: 在此输入图像描述

当我将这些更改为相对路径时,错误就会消失: 在此输入图像描述

其他编辑的代码检查似乎与前者没有问题.我们已经确认它在VS Code和JetBrains Rider中工作.

我的tsconfig.json如下:

{
	"compilerOptions": {
		"noImplicitAny": false,
		"noEmitOnError": true,
		"strictNullChecks": true,
		"removeComments": false,
		"sourceMap": true,
		"target": "es5",
		"module": "amd",
		"moduleResolution": "node",
		"baseUrl": "./Content/ts"
	},
	"exclude": [
		"node_modules"
	],
	"compileOnSave": true
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试了尽可能多的不同的Visual Studio设置,但似乎没有任何东西影响intellisense是否能够找到模块.同样,编译器本身没有问题找到它们并构建.

更新:忘记包含我们还在<TypeScriptBaseUrl>.csproj文件中定义的属性,设置为与tsconfig.json中相同的值.这会导致Visual Studio中的TS构建成功,但似乎不会影响Intellisense.

Bri*_*van 5

原来需要在项目中包含 tsconfig.json 文件才能让 Intellisense 满意。不知道为什么<TypeScriptBaseUrl>设置不够好。这可能仍然是一个需要报告的错误。