Skip to content

Conversation

danez
Copy link
Collaborator

@danez danez commented Aug 18, 2016

This is basically #97 but without throwing an error.

I also enabled to eslint rules to detect undefined and unused variables.

Closes #97

palange and others added 3 commits August 18, 2016 21:56
Refactor to resolve, when possible, a list of props
from a flow intersection type and to throw an error
when encountering a Props of union type.

This change addresses a bug found in the flowTypeDocBlockHandler
while a props type that is an IntersectionTypeAnnotation or a
UnionTypeAnnotation.

Union types throw an error, rather than generating misleading documentation.
When given a union type, flow will enforce that props conform to only one of
the union-ed types. The documentation format, which lists a single set of props
can't express this.

Fix lint errors
@danez danez merged commit b15e1d4 into reactjs:master Aug 18, 2016
@danez danez deleted the fix-intersection branch August 18, 2016 20:37
`).get('expression');

expect(() => flowTypeDocBlockHandler(documentation, definition))
.toThrowError(TypeError, "react-docgen doesn't support Props of union types");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this not throw as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. The test wasn't executed because of wrong nesting. Fixed it.

@fkling
Copy link
Member

fkling commented Aug 18, 2016

Thanks for that! I added two comments which I guess don't show in here because the branch got deleted. But they should be visible when you click on "Files".

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants