microsoft / microsoft/TypeScript
Function implementation name must be ... (2389) when abstract method is declared again later
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
### 🔎 Search Terms
duplicate abstract function declaration, abstract method, missing implementation, abstract method overload
### 🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about abstract class
### ⏯ Playground Link
https://www.typescriptlang.org/play/?#code/IYIwzgLgTsDGEAJYBthjAgYge2wg3gFAIkKiQzwIBmArgHawAiApigIwAUAlAFwIA3bAEsAJgG5CxUnUasUAJh78Kw+gHMC00qSgsItKPQQByABbCT2hAF9r18tDiJZzNsi59BIiYTtA
### 💻 Code
```ts
abstract class Foo {
abstract func1(): void;
func2(): string {
// ^? Function implementation name must be 'func1'.(2389)
return 'hi'
}
abstract func1(): void;
}
```
### 🙁 Actual behavior
TS error reported for `func2`, which is valid.
### 🙂 Expected behavior
TS error reported for `func1`, which has duplicated abstract declaration.
### Additional information about the issue
_No response_
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 TypeScript Playground 链接和 issue 中的抽象类示例重现该诊断。跟踪编译器如何为重复的抽象声明分配实现名称错误;完成的标准是错误指向重复的 func1 声明,而不是有效的 func2 实现。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100