How to generate correct prop types when the prop-types package is not explicitly imported?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react, webpack
- Ambito
- documentation, tooling
Direzione di ricerca
Inizia leggendo il resolveToModule util e gli handler esistenti per prop-types. Riproduci il caso in cui webpack ProvidePlugin fornisce PropTypes senza un import esplicito di prop-types, quindi determina se un handler esistente lo supporta; il lavoro è completato quando l'output generato riporta tipi concreti come string o bool invece di custom.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there a recommended way to generate prop types when the prop-types package is not explicitly imported into each component? For example, in my project, PropTypes is provided as a global through webpack's providePlugin:
config: {
plugins: [
new ProvidePlugin({
PropTypes: 'prop-types',
}),
]
};
So PropTypes is available to any react component—even when it is not imported.
I see the resolveToModule util looks for the prop-types import, and if it is not found, we end up with custom prop types rather than their actual type, like string or bool. It seems I can create a handler to generate prop types even when the prop-types package is not explicitly imported, but is there an already existing handler or other way to do this that addresses this case?
- Lingua principale
- TypeScript
- Stelle
- 3.8k
- Fork
- 316
- Merge medio
- 3h 28m
- PR unite (30g)
- 6
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di reactjs/react-docgen
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
reactjs/react-docgen#1102 ·
-
Typescript Status Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
reactjs/react-docgen#1005 · 4 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
reactjs/react-docgen#997 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
reactjs/react-docgen#994 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
reactjs/react-docgen#982 · 2 commenti ·
Tutte le issue di reactjs/react-docgen
Issue simili
-
Browser Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
getsentry/sentry-javascript#24577 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
agilepathway/label-checker#640 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
copse-dev/agent-pane#2953 ·
-
[aw] Upgrade available Apertaagentic-workflows
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
anomalyco/models.dev#7701 ·