microsoft / microsoft/TypeScript
Unrelated interface causes assignability to change
オープン
@ahejlsberg がすでに取り組んでいます。
2023年10月16日 から。
Needs Investigation
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
5.3 regression
🕗 Version & Regression Information
- This changed between versions 5.3.0-dev.20230823 and 5.3.0-dev.20230824
⏯ Playground Link
💻 Code
export { }
interface Map<V> extends Collection<V> {
flatMap<VM>(): Map<VM>;
}
interface Collection<V> {
value: V; // sprinkle some covariance
map: Map<V>;
concat(): Collection<unknown>;
flatMap(): Collection<V>;
flatMap<VM>(): Collection<VM>;
}
// Comment out and it works like in 5.2
interface Keyed extends Collection<number> {
concat(): Keyed;
}
type R = Map<never> extends Collection<infer V> ? V : "NO";
const r = null! as R;
const t: "NO" = r;
🙁 Actual behavior
R is unknown. Removing Keyed makes R "NO", even though Keyed is unused otherwise.
🙂 Expected behavior
Not really sure. I'd settle for the stable 5.2 behavior, which is for R to be "NO" although that also seems wrong (Why doesn't Map<never> extends Collection? If we remove flatMap(): Collection<V> from Collection then Map<never> extends Collection. This seems like the correct behavior.)
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。