microsoft / microsoft/TypeScript
Invalid type inference when using arrow function but normal functions is ok
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Bug Report
🔎 Search Terms
Invalid type inference with arrow function
🕗 Version & Regression Information
- This changed between versions
@effect/io^0.30and@effect/io>=0.31. The main change that I suspect is causing the bug is this commit.
⏯ Playground Link
At least, playground cannot import third-party lib(effect). so here, I provide some stackblitz links:
@effect/io <=0.30+ TS 5.1: https://stackblitz.com/edit/typescript-qiykfu (This is what I think is actual behavior)@effect/io ^0.32+ TS 5.1: https://stackblitz.com/edit/typescript-wjbz9s@effect/io ^0.32+ TS 5.2 (dev, next channel): https://stackblitz.com/edit/typescript-tbg3w8
💻 Code
🙁 Actual behavior
If you write it as a regular function expression, the type is inferred without any problems. but writing in arrow function expressions causes problems with type inference.
🙂 Expected behavior
In the same way that the Effect library works, the resolve function should be correctly typed by inferring the dependencies passed through the effect object, the type of the required objects, and the way the function is written. There should be no difference in the way the resolve function is written.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず 3 つの StackBlitz 再現を比較し、報告でリンクされている疑わしい @effect/io のコミットを調査します。その際、推論に影響する変更に焦点を当ててください。通常の関数形式とアロー関数形式が同等である場合の動作を確認してください。完了とは、アロー形式がエフェクトの依存関係と必要なオブジェクト型から、同じ方法で resolve を推論することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100