reactjs / reactjs/react-docgen
Type annotation with flow syntax and defaulting of args is breaking React Class validator
Open
Nobody has claimed this yet.
needs-more-info
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 316
- Avg merge
- 5h 7m
- Merged PRs (30d)
- 4
Description
Hello,
Thanks for your library!
I ran into an issue where a option (flow annotation) argument in a handler was causing my class to not be parsed.. resulting in You have to export at least one valid React Class!. Defaulting the arg also seems to break things.
Breaks:
handleThings = (id: number, active?: boolean) => () => {
things..
}
handleThings = (id: number, active: boolean = false) => () => {
things..
}
Works:
handleThings = (id: number, active: boolean) => () => {
things..
}
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the React Class validator and reproduce the two failing JSX examples alongside the working example. Trace why optional Flow annotations and default argument values prevent the class from being recognized; done means all three forms are parsed as valid React classes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100