Visual Studio 2017 - HTML 文件中的 TypeScript 智能感知
我创建了一个 TypeScript 文件,并通过将 ts 文件拖到 HTML 中,Visual Studio 在我的 HTML 文件中添加了引用。
现在虽然 ts 文件有类型信息,但 HTML 中的 Intellisense 并不提供这些信息。
如何在 HTML 文件中让 Intellisense 提示来自引用的 ts 文件的类型信息?
答案#1
您可以按照这个 MSDN 中提到的方式为 HTML 编辑器 IntelliSense 编写 JSDoc。
https://msdn.microsoft.com/en-us/library/mt162307.aspx?f=255&MSPPError=-2147217396
/** @description Determines the area of a circle that has the specified radius parameter.
* @param {number} radius The radius of the circle.
* @return {number}
*/
function getArea(radius) {
var areaVal;
areaVal = Math.PI * radius * radius;
return areaVal;
}

