reactjs / reactjs/react-docgen
Using `Readonly<T>` utility type results in losing pieces of `T`'s information
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.8k
- Forks
- 316
- Ø Merge
- 5 Std. 7 Min.
- Gemergte PRs (30 T.)
- 4
Beschreibung
You can paste the code below in the playground and see that description and tsType are lost.
interface Props {
/** The name to greet */
name: string
}
/**
* Hello world component
*/
const MyComponent = ({name = 'world'}: Props) => {
return <div />;
}
/**
* Hello world Readonly
*/
const MyReadonlyPropsComponent = ({name = 'world'}: Readonly<Props>)=> {
return <div />;
}
I noticed this behaviour while digging through an issue that appeared after the latest Storybook's major update, which uses this package by default to extract information from the components.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das Problem im verlinkten Playground anhand der beiden Komponentenbeispiele und vergleiche die extrahierten Ergebnisse für Props und Readonly. Die Korrektur ist abgeschlossen, wenn das Ergebnis für Readonly die für Props angezeigte Prop-Beschreibung und tsType-Information beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100