reactjs / reactjs/react-docgen
Interface extends are supported but not the type ampersand syntax
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
If we use types in Typescript that can be extended with ampersand syntax &, it won't work.
For example, we have a pretty funky type definition like this in our repository:
export type ILinkProps = ITypeAgnosticLinkProps &
Omit<INextLinkProps, "children"> & {
/**
* Disables a link, visually and functionally
* @default false
*/
isDisabled?: boolean;
/**
* Sets `target="_blank"` and `rel="noreferrer"` explicitly.
* If props contain `target="_blank"` and `rel="noreferrer"`
* this will be set to isExternal automatically.
* _NOTE:_ This is a pure technical flag, if you're looking for a visual
* representation of an external link, use the `icon` and the `iconPosition` prop.
*/
isExternal?: boolean;
};
First it won't work because of the Omit, but if that would be solved (or deleted), it still doesn't work as the & is not recognized as extends.
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
Beginne damit, das gemeldete TypeScript-Beispiel einschließlich des Omit-Utilities und der Ampersand-Intersections zu reproduzieren, und verfolge dann den Typanalysepfad, der interface extends verarbeitet. Prüfe vorhandene Tests zur TypeScript-Typ-Extraktion, falls verfügbar. Fertig ist die Aufgabe, wenn sowohl die Intersection-Syntax als auch die gezeigte Omit-basierte Definition erkannt werden, ohne das bestehende Verhalten von interface extends zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- documentation
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100