typescript - HTML 文件中的 TypeScript 智能感知
问题描述
我创建了一个 TypeScript 文件,并通过将 ts 文件拖到 HTML 中,Visual Studio 在我的 HTML 文件中添加了引用。
现在虽然 ts 文件有类型信息,但 HTML 中的 Intellisense 不提供它们。
如何从 HTML 文件中引用的 ts 文件中生成 Intellisense 提示类型信息?
解决方案
You can write JSDoc as mentioned in this MSDN for HTML Editor Intellisense.
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;
}
推荐阅读
- javascript - Jest 测试在 Github Action 上失败但在本地通过
- git - 为什么 git merge --no-commit 在我取消暂存时向我的历史记录添加了提交?
- javascript - Nodemailer 不适用于反应联系表
- html - 元素未正确定位
- java - Spring Batch 两次执行作业
- google-sheets - 如何从 Google 表格中的数据集创建新表?
- ipfs - IPFS:MFS 中的符号链接
- c - C99:访问全局变量和别名内存指针时的编译器优化
- powershell - 如何防止 PowerShell 脚本中的尾随换行符?
- three.js - 为什么三个 js 精灵上的换行符 '\n' 不起作用?