microsoft / microsoft/TypeScript

Invalid type inference when using arrow function but normal functions is ok

オープン
#55,017 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Needs More Info
主要言語
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.30 and @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:

💻 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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず 3 つの StackBlitz 再現を比較し、報告でリンクされている疑わしい @effect/io のコミットを調査します。その際、推論に影響する変更に焦点を当ててください。通常の関数形式とアロー関数形式が同等である場合の動作を確認してください。完了とは、アロー形式がエフェクトの依存関係と必要なオブジェクト型から、同じ方法で resolve を推論することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。