vscode IntelliSense do do jsdoc检测对象类型
我在项目中使用JavaScript和Typescript的JSDOC使用JSDOC,并且我注意到,如果将参数定义为object
类型,则在JS文件中,VSCODE INTELLISENSE将其显示为type 任何。
/**
* @param {Object} options -
*/
function testFunc(options) {
return options;
}
从我阅读的内容中noreferrer“> typescript手册和 jsdoc 对象
不应该有任何区别,我希望VSCODE IntelliSense在悬停时正确显示为Object
类型。
此外,与其他类型不同,返回类型不是自动推断出的,并且显示为任何
类型。
I'm using JSDoc in my project having both javascript and typescript, and I notice that in my js file if a parameter is defined as Object
type then VSCode intellisense shows it as type any
.
/**
* @param {Object} options -
*/
function testFunc(options) {
return options;
}
If I use object
then it seems to work fine.
From what I've read typescript handbook and jsdoc Object
or object
shouldn't make any difference, and I'm expecting vscode intellisense to show it properly as object
type upon hover.
Furthermore, unlike other types, return type is not inferred automatically and it shows as any
type.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对象
是打字稿的东西,当您在LowerCase中传递Object
时,它将类Object
作为现有。当您说@Param可以在JavaScript中采用对象
时,就像说它可以取任何东西,因为没有区别。在Typescript中,当您仅想要Objects
而不是号码>数字>
, arrays &布尔值
...The
Object
is a typescript thing, when you passobject
in lowercases, it considers the classobject
as existing. When you says the @param can take anObject
in javascript, it's like saying it can take anything, because there is no difference. In TYPESCRIPT, the typeObject
is needed when you only wantObjects
and notNumbers
,Arrays
&booleans
...