RefTypes inside Interface does not expand correctly in Typescript
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- react, typescript
- 領域
- tooling
調査の方向性
fixtures_23.tsx にある変更済みのインターフェース例から始め、TSComponent 用に生成された JSON を再現してください。props.something に対して BaseProps インターフェースがどのように表現されるかを追跡してください。出力に BaseProps という名前だけでなくインターフェース定義が含まれ、既存の baz の出力が維持されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Original Example (fixtures_23.tsx)
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import React, { Component } from 'react';
type BaseProps = {
/** Optional prop */
foo?: string,
/** Required prop */
bar: number
};
type TransitionDuration = number | { enter?: number, exit?: number } | 'auto';
type Props = BaseProps & {
/** Complex union prop */
baz: TransitionDuration
}
/**
* This is a typescript class component
*/
export default class TSComponent extends Component<Props> {
render() {
return <h1>Hello world</h1>;
}
}
The output for the above example seems to be generated correctly.
Modified example with interfaces
import React, { Component } from "react";
interface BaseProps {
/** Optional prop */
foo?: string;
/** Required prop */
bar: number;
}
type TransitionDuration = number | { enter?: number; exit?: number } | "auto";
interface Props {
something: BaseProps;
/** Complex union prop */
baz: TransitionDuration;
}
/**
* This is a typescript class component
*/
export default class TSComponent extends Component<Props> {
render() {
return <h1>Hello world</h1>;
}
}
Output
{
"description": "This is a typescript class component",
"displayName": "TSComponent",
"methods": [],
"props": {
"something": {
"required": true,
"tsType": {
"name": "BaseProps"
},
"description": ""
},
"baz": {
"required": true,
"tsType": {
"name": "union",
"raw": "number | { enter?: number; exit?: number } | \"auto\"",
"elements": [{
"name": "number"
}, {
"name": "signature",
"type": "object",
"raw": "{ enter?: number; exit?: number }",
"signature": {
"properties": [{
"key": "enter",
"value": {
"name": "number",
"required": false
}
}, {
"key": "exit",
"value": {
"name": "number",
"required": false
}
}]
}
}, {
"name": "literal",
"value": "\"auto\""
}]
},
"description": "Complex union prop"
}
}
}
Issue
props.something in the above output has only the name and not the interface which is defines.
- 主要言語
- 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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug v2
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
modelcontextprotocol/inspector#2458 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
carbon-design-system/ibm-products#9907 ·