microsoft / microsoft/TypeScript

`new super()` in static method does not cause error

未关闭
#63,451 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Bug Domain: classes
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

### 🔎 Search Terms

super

### 🕗 Version & Regression Information

This exists in ts6.0

### ⏯ Playground Link

_No response_

### 💻 Code

```ts
class A extends class {} {
static {
new super()
}

static f() {
new super()
}
}
```

### 🙁 Actual behavior

no error

### 🙂 Expected behavior

`new super()` is invalid and should throw error.

### Additional information about the issue

_No response_

贡献指南

打开贡献指南

调研方向

首先编译提供的 TypeScript 代码片段,并确认 `new super()` 的两处使用都不会产生诊断信息。跟踪编译器在静态块和静态方法中对 `super` 的处理,然后验证无效构造在两种上下文中都会被拒绝。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
compilers
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。