reactjs / reactjs/react-docgen
Better TS enum support
オープン
まだ誰も着手していません。
new feature
typescript
- 主要言語
- TypeScript
- スター
- 3.8k
- フォーク
- 316
- 平均マージ
- 5時間 7分
- マージ済み PR(30日)
- 4
説明
Reporting from https://github.com/storybookjs/storybook/pull/24165
Currently TS enums analysis is lossy:
enum ButtonType {
Button = 'button',
Reset = 'reset',
Submit = 'submit',
}
type ButtonTestProps = {
type?: ButtonType;
};
export const ButtonTest = (props: ButtonTestProps) => {
return <button {...props}>Test</button>;
};
Produces:
"tsType": {
"name": "ButtonType"
},
Compare this to a union:
type ButtonType = "button" | "reset" | "submit";
Which produces:
"tsType": {
"name": "union",
"raw": "\"button\" | \"reset\" | \"submit\"",
"elements": [
{
"name": "literal",
"value": "\"button\""
},
{
"name": "literal",
"value": "\"reset\""
},
{
"name": "literal",
"value": "\"submit\""
}
]
},
It would be fantastic if react-docgen could produce something similar for enums!
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
issue にはファイル、テスト、エントリーポイントが記載されていません。報告にある enum と union の例を再現し、次に、示されている tsType オブジェクトを生成する TypeScript の解析パスを特定してください。enum のメンバーが union の出力と同等の構造化された情報を保持し、関連する既存の checks が通れば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- react, typescript
- 領域
- documentation, tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100