microsoft / microsoft/TypeScript
Property is not assignable to the same property in generic base type
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
### 🔎 Search Terms
Property is not assignable to the same property in generic base type
### 🕗 Version & Regression Information
-This is the behavior in every version I tried, and I reviewed
### ⏯ Playground Link
https://www.typescriptlang.org/zh/play/?ts=5.8.3#code/IYIwzgLgTsDGEAJYBthjAgSgCwPYIG8AoBBUSGeBABwEsATAc1oDswAeAMQH0BRBAKYAPCAJb0MLAK4BbEAKgAaBDwBSAPgAUIKFLABHKQMgAuFd1UIAPud4BKM2uu2A3EQC+RFGgwAhZFIAZoEKgiJiElh4hCQ0DMxsXHxhouKSsvJK5hraugZGptnOPPaOFsXJscSkpFACEFJQLKQ6eobGEG6knp5AA
### 💻 Code
```ts
abstract class Rho {
abstract pidgins(brusquest: F_J | F_E): F_J | F_E;
}
class Bluffer extends Rho {
pidgins(brusquest: F_J | F_E): F_J | F_E
{
return brusquest;
}
}
```
### 🙁 Actual behavior
Property 'pidgins' in type 'Bluffer' is not assignable to the same property in base type 'Rho'.
Type '(brusquest: F_E | F_J) => F_E | F_J' is not assignable to type '(brusquest: F_E | F_J) => F_E | F_J'. Two different types with this name exist, but they are unrelated.
Type 'number | F_E | F_J' is not assignable to type 'F_E | F_J'.
Type 'number' is not assignable to type 'F_E | F_J'.(2416)
### 🙂 Expected behavior
No error
### Additional information about the issue
The following works with no error:
```
abstract class Rho {
abstract pidgins(brusquest: F_J | F_E): F_J | F_E;
abstract pidgins(brusquest: F_J | F_E): F_J | F_E;
}
class Bluffer extends Rho {
pidgins(brusquest: F_J | F_E): F_J | F_E
{
return brusquest;
}
}
```
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた TypeScript Playground の例を再現することから始め、Rho のジェネリックメソッドと Bluffer の実装を比較します。ジェネリックメソッドの互換性に関する型チェックの経路を追跡します。再現結果でエラーが報告されず、関連する代入可能性の動作を壊していなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100