您可以尝试如下操作:
// @ts-check
/*
* @typedef {{
* age: number,
* getMother(arg1: string, arg2: string): HTMLCat
* } & HTMLElement} HTMLCat
*/
/*
* @type {HTMLCat}
*/
var cat;
cat.getMother('a', 'b').age
我不确定AdditionalCat
确切在做什么,因为它只是一个对象,可能与key/value
我添加的索引相关,所以我省略了它。但是这种语法可能更容易推断。
您可以在此处找到更多示例:https : //medium.com/better-programming/type-checking-in-vscode-without-typescript-eba92161cd08
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句