reactjs / reactjs/react-docgen

@defaultValue is not parsed from interface

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

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

主要言語
TypeScript
スター
3.8k
フォーク
316
平均マージ
5時間 7分
マージ済み PR(30日)
4

説明

The following code tested in the playgroud https://react-docgen.dev/playground

interface Props {
  /** 
   * The name to greet
   *
   * @defaultValue 'something'
   */
  name: string;
}

/**
 * Hello world component
 */
const MyComponent = (props: Props) => {
  return <div />;
}

returns:

[
  {
    "description": "Hello world component",
    "displayName": "MyComponent",
    "methods": [],
    "props": {
      "name": {
        "required": true,
        "tsType": {
          "name": "string"
        },
        "description": "The name to greet\n\n@defaultValue 'something'"
      }
    }
  }
]

I think the defaultValue property is missing and should appear in the result, and part of the description "@defaultValue 'something'" should be removed.

[
  {
    "description": "Hello world component",
    "displayName": "MyComponent",
    "methods": [],
    "props": {
      "name": {
        "required": true,
        "tsType": {
          "name": "string"
        },
        "description": "The name to greet",
        "defaultValue": {
          "value": "'something'",
          "computed": false
        }
      }
    }
  }
]

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

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

はじめの一歩

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

調査の方向性

react-docgen playground で TypeScript のインターフェース例を再現し、その JSDoc タグがどのように解析されるかを確認します。@defaultValue が説明から削除され、期待される値を持つ非計算の defaultValue として出力されることを確認します。完了確認には、示されている出力を使用します。

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

評価

技術スタック
typescript
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
48/100

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

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