microsoft / microsoft/TypeScript
Incorrect diagnostic message in TS2814
未关闭
还没有人认领这个 Issue。
Bug
Domain: Error Messages
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
🔎 Search Terms
2814, function body
🕗 Version & Regression Information
- regression at
v4.4.4.
⏯ Playground Link
💻 Code
// tests/cases/compiler/callOverloads1.ts
class Foo {
bar1() { }
}
function Foo();
//~^ error report: Function with bodies can only merge with classes that are ambient.
🙁 Actual behavior
The function Foo actually has no body (it's just a declaration), yet the error message says "Function with bodies...", which may be a bit confusing.
🙂 Expected behavior
Either show a hint like "Only functions can merge with ambient classes," or suppress the error report for functions without a body because class Foo will report Class declaration cannot implement overload list for 'Foo'.
Additional information about the issue
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 tests/cases/compiler/callOverloads1.ts 开始,并使用提供的 Playground 示例重现 TS2814 诊断。跟踪与类合并的函数声明的诊断,然后选择并验证 issue 中所描述的报告消息或抑制行为。更新编译器测试的预期结果,使其不再接受不正确的措辞。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 68/100