Confused react type names on Flow and Typescript

オープン
#395 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
react, typescript

調査の方向性

TypeScript の例を再現し、ReactNode と React.ReactNode に対して示された props JSON を生成する parser の経路を調査します。Flow と TypeScript の結果を比較し、報告された型名が一貫して処理され、既存の出力がリグレッションしないことを確認します。

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

説明

breaking bug

Hi, I try convert react-docgen props to JSON-schema. But in typescript and flow, we get different names by different ways to program.Just like this. This ReactReactNode makes me so confused. How should i do with it ?

import React, { ReactNode, Component } from 'react';

interface Props {
  content: ReactNode,
  children: React.ReactNode,
}

class TSReactComponent extends Component<Props> {
  render() {
    return (
      <div>hello world</div>
    );
  }
}

export default TSReactComponent;

react-docgen result

{
  "description": "",
  "displayName": "TSReactComponent",
  "methods": [],
  "props": {
    "content": {
      "required": true,
      "flowType": {
        "name": "ReactNode"
      },
      "description": ""
    },
    "children": {
      "required": true,
      "flowType": {
        "name": "ReactReactNode",
        "raw": "React.ReactNode"
      },
      "description": ""
    }
  }
}
主要言語
TypeScript
スター
3.8k
フォーク
316
平均マージ
5時間 7分
マージ済み PR(30日)
4

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

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

はじめの一歩

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

reactjs/react-docgen のほかの issue

reactjs/react-docgen の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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