[TS] parse returns props without type field.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react, typescript
- Ambito
- documentation, tooling
Direzione di ricerca
Riproduci l'input TSX fornito tramite l'entry point parse(context.code, ...) e ispeziona rawReactDocs.props. Quindi confronta i metadati delle props restituiti con il campo type previsto. Traccia il motivo per cui l'output del parser omette quel campo e aggiungi una coverage che mostri i metadati corretti per questo esempio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
the input code
import React from 'react';
import './button.css';
export interface ButtonProps {
/**
* Is this the principal call to action on the page?
*/
primary?: boolean;
/**
* What background color to use
*/
backgroundColor?: string;
/**
* How large should the button be?
*/
size?: 'small' | 'medium' | 'large';
/**
* Button contents
*/
label: string;
/**
* Optional click handler
*/
onClick?: () => void;
}
/**
* Primary UI component for user interaction
*/
export const Button: React.FC<ButtonProps> = ({
primary = false,
size = 'large',
backgroundColor,
label,
...props
}) => {
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
return (
<button
type="button"
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
style={{ backgroundColor }}
{...props}
>
{label}
</button>
);
};
the parse code
const rawReactDocs = parse(context.code, null, null, {
filename: context.fileName, //path.resolve(),
babelrc: false,
});
console.log("rawReactDocs", rawReactDocs)
const rawProps = rawReactDocs.props || {};
const props = Object.keys(rawProps)
.filter(name => name !== "children")
// .filter(name => rawProps[name].type || rawProps[name].tsType || rawProps[name].flowType)
.map(name => ({ name, value: rawProps[name] }));
console.log("props", props)

- 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
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
copse-dev/agent-pane#2953 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Apertabug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
calcite-components needs triage refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Esri/calcite-design-system#15203 ·