microsoft / microsoft/TypeScript
Inference from annotated parameters of context-sensitive functions is order dependent
オープン
まだ誰も着手していません。
Bug
Domain: check: Type Inference
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
inference annotated parameters context sensitive order
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
💻 Code
declare function test<T, A, B>(obj: {
ctx: T;
a: (a: A, ctx: T) => void;
b: (b: B, ctx: T, a: A) => void;
}): void;
test({
ctx: 'foo',
a: (a: string, ctx) => {},
b: (b: string, ctx, a) => {},
});
test({
ctx: 'foo',
b: (b: string, ctx, a) => {},
a: (a: string, ctx) => {},
});
🙁 Actual behavior
The second call doesn't infer properly
🙂 Expected behavior
I'd expect the second call to be inferred as good as the first one
Additional information about the issue
related to https://github.com/microsoft/TypeScript/issues/47599
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた TypeScript Playground で 2 つの呼び出しを再現し、それらの推論動作を比較してから、コンテキストを把握するために関連する issue #47599 を読んでください。型推論とコンテキスト型付けに関係する経路を調査してください。既存の例をリグレッションさせずに、2 番目のオブジェクトプロパティの順序でも 1 番目と同じように正常に推論されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100