Missing support for Flow Unions
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, react
調査の方向性
react-docgen v3.0.0-beta10 を使用して issue の例を再現し、結果を union に対して期待される props と比較します。リンクされている Flow の unions のドキュメントを読み、component props を処理する parser のエントリポイントを追跡します。ユーザーにすべての props を 1 つのオプショナル型にフラット化することを要求せずに union のメンバーが認識されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
react-docgen doesn't recognize the props if it's an union type:
type BaseProps = {|
label: string,
|};
type LinkButtonProps = {|
...BaseProps,
href: string,
target?: string,
rel?: string,
|};
type ButtonProps = {|
...BaseProps,
type?: 'button' | 'submit',
|};
type Props = ButtonProps | LinkButtonProps;
class MyButton extends React.Component<Props> {
render() {
// conditionally render `<a>` or `<button>` based on props...
}
}
I don't want users to pass props that are specific to <a> at the same time as some props that are specific to <button> - I know this kind of pattern of having a single component render to <a> or <button> is "weird", but some of our legacy components use it...
For now I need to define a single type that includes all the props and mark them all as optional - which is "fine", I guess..
More info about unions here: https://flow.org/en/docs/types/unions/
tested on v3.0.0-beta10
- 主要言語
- TypeScript
- スター
- 3.8k
- フォーク
- 316
- 平均マージ
- 3時間 28分
- マージ済み PR(30日)
- 6
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
reactjs/react-docgen のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
reactjs/react-docgen#1102 ·
-
Typescript Status オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
reactjs/react-docgen#1005 · リアクション 4 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
reactjs/react-docgen#997 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
reactjs/react-docgen#994 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
reactjs/react-docgen#982 · コメント 2 件 ·
reactjs/react-docgen の issue をすべて見る
似ている issue
-
bot:ai-assisted component:compact-js status:untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
midnightntwrk/midnight-sdk#403 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
joinmarket-webui/jam#1496 · コメント 1 件 ·
-
Tech
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
opencrvs/opencrvs-core#13865 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
linagora/twake-calendar-frontend#1377 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
EclipseFdn/open-vsx.org#13385 · コメント 1 件 ·