Allow flow inference of cast variable definitions.
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, react, typescript
調査の方向性
この issue には、リポジトリのファイル、テスト、エントリポイントがありません。まず、2 つの Elevation の例を入力として使用し、react-docgen がコンポーネント定義と Flow の型アノテーションをどのように検出するかを追跡します。cast による代入がコンポーネントとして検出され、その props 型が wrapper なしで抽出されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I love this library, I use it to generate the documentation for https://jamesmfriedman.github.io/rmwc/.
If this library could detect cast expressions from Flow, it seemingly would fix any sort of style related issue for how people wanted to write their components.
I tried implementing this myself, but I just don't know enough about the codebase to make it happen.
For reference, this is what I'm currently doing to hack around this. I have a factory function that can't be detected, so I have to have a separate component that wraps it just to capture the flowtype definition. I get a lot of utility out of this library, but this is something I really wish I could fix.
BAD EXAMPLE
// @flow
// eslint-disable-next-line no-unused-vars
import * as React from 'react';
import { simpleTag } from '@rmwc/base';
import type { SimpleTagPropsT } from '@rmwc/base/simpleTag';
export type ElevationPropsT = {
/** A number from 0 - 24 for different levels of elevation */
z: number | string,
/** Allows for smooth transitions between elevations when the z value changes. */
transition?: boolean
} & SimpleTagPropsT;
const ElevationRoot = simpleTag({
displayName: 'ElevationRoot',
defaultProps: {
z: 0,
transition: false
},
tag: 'div',
classNames: (props: ElevationPropsT) => [
`mdc-elevation--z${props.z}`,
{ 'mdc-elevation-transition': props.transition }
],
consumeProps: ['z', 'transition']
});
// I HAVE TO RE-WRAP THIS JUST TO MAKE IT WORK
/**
* The Elevation Component
*/
export const Elevation: React.ComponentType<ElevationPropsT> = (
props: ElevationPropsT
) => <ElevationRoot {...props} />;
Elevation.displayName = 'Elevation';
export default Elevation;
WHAT WOULD BE AMAZING
// @flow
// eslint-disable-next-line no-unused-vars
import * as React from 'react';
import { simpleTag } from '@rmwc/base';
import type { SimpleTagPropsT } from '@rmwc/base/simpleTag';
export type ElevationPropsT = {
/** A number from 0 - 24 for different levels of elevation */
z: number | string,
/** Allows for smooth transitions between elevations when the z value changes. */
transition?: boolean
} & SimpleTagPropsT;
// MAKE THIS WORK BECAUSE IT IS CASTING TO React.ComponentType<ElevationPropsT>
/**
* The Elevation Component
*/
const Elevation: React.ComponentType<ElevationPropsT> = simpleTag({
displayName: 'Elevation',
defaultProps: {
z: 0,
transition: false
},
tag: 'div',
classNames: (props: ElevationPropsT) => [
`mdc-elevation--z${props.z}`,
{ 'mdc-elevation-transition': props.transition }
],
consumeProps: ['z', 'transition']
});
export default Elevation;
- 主要言語
- 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
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
Mend: dependency security vulnerability untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100