microsoft / microsoft/TypeScript

Decouple jsx element type from jsx factory return type and sfc return type

オープン
#21,699 コメント 123 件 リアクション 533 件 担当者 0 名 GitHub で見る

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

Breaking Change Domain: JSX/TSX Effort: Moderate Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

We need to look up the type of a jsx expression by actually resolving the jsx factory call, so that we don't create a reference to the global JSX.Element type, which can change shape between react versions (as it needs to in the react 16 upgrade). We also need to resolve the sfc return type and class element type from the parameters of the factory function overloads for the same reasons, doubly so because the types allowable as render method and SFC return values are no longer the same as JSX.Element (namely, they can be strings, arrays, portals, etc).

This might be considered a breaking change, because some consumers may expect JSX.Element to always be a supertype of both jsx element expression return types and SFC return types (even though this isn't true in react 16) - we certainly made that assumption internally, hence the need for the change. 🐱

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

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

はじめの一歩

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

調査の方向性

まず、JSX 式のチェックを解決済みの JSX factory 呼び出しまでたどり、次に factory のオーバーロードパラメーターが SFC とクラスの要素型をどのように提供するかを調べます。完了とは、提示された React 16 のケースでこれらの型がグローバルな JSX.Element に依存しなくなることです。issue ではファイルもテストも指定されていません。

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

評価

技術スタック
react, typescript
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

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

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