Compiler Result implementations reject valid variant-changing chains
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 251k
- フォーク
- 51.4k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 53
説明
React version
Current main (2dc7da790d63).
Steps to reproduce
Type-check direct compiler utility chains such as:
Ok(2).andThen(() => Err("failed"));
Ok(2).and(Err("failed"));
Err("failed").or(Ok(4));
Err("failed").orElse(() => Ok(4));
Current behavior
The concrete OkImpl combinators fix the error type to never; ErrImpl.or fixes the success type to never; and ErrImpl.orElse accepts only another ErrImpl. These valid variant-changing chains fail TypeScript compilation with TS2322/TS2345 even though their runtime implementations naturally return the supplied result.
Expected behavior
The concrete implementations should preserve the Rust-style Result combinator behavior and infer the success/error types of the returned result without changing runtime semantics.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず OkImpl と ErrImpl の Result 実装を見つけ、issue にあるバリアントを変更する 4 つの例の型チェックを行います。実行時の動作を維持したまま、それらの例がコンパイルできるように具体的なコンビネータの型定義を更新し、その後 TypeScript のエラーがなくなり、既存のチェックにも引き続きパスすることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 70/100