microsoft / microsoft/TypeScript
jsdoc @type is not working properly for some class method variant
未关闭
还没有人认领这个 Issue。
Awaiting More Feedback
Suggestion
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
TypeScript Version: 4.0.0-beta and 3.9.2
Search Terms: jsdoc, type, typedef, class method, typechecking
Code
// @strict: false
/**
* @typedef {(newNumber: number) => void} SetNumberFunc
*/
class A {
/**
* @type {number}
*/
a = 0;
constructor() {
this.a = 0;
}
/**
* @type {SetNumberFunc}
*/
setAVariant1(newNumber) {
this.a = newNumber;
}
}
Expected behavior: The newNumber param should have a number type when hovering on the setAVariant1 method.
Actual behavior: The newNumber param have any type when hovering on the setAVariant1 method.
Playground Link: Playground Link
Related Issues: -
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 TypeScript Playground 复现开始,检查如何处理类方法 setAVariant1 的 JSDoc @type 注释。将 newNumber 的悬停类型与预期的 number 类型进行比较,并验证修复完成后,复现结果报告的是 number 而不是 any。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100