We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following:
import React from 'react'; type Props = { children: React.ReactNode; } & { children?: React.ReactNode; } const Component = ({ children }: Props) => { return <div>{children}</div> } export default Component;
Gives these results:
{ "description": "", "displayName": "Component", "methods": [], "props": { "children": { "required": false, "tsType": { "name": "ReactReactNode", "raw": "React.ReactNode" }, "description": "" } } }
As you can see, children are NOT required, however, if I switch the order of the intersection type:
children
import React from 'react'; type Props = { children?: React.ReactNode; } & { children: React.ReactNode; } const Component = ({ children }: Props) => { return <div>{children}</div> } export default Component;
Then the result is different, with children now being required...
{ "description": "", "displayName": "Component", "methods": [], "props": { "children": { "required": true, "tsType": { "name": "ReactReactNode", "raw": "React.ReactNode" }, "description": "" } } }
Is this expected behaviour?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The following:
Gives these results:
As you can see,
children
are NOT required, however, if I switch the order of the intersection type:Then the result is different, with
children
now being required...Is this expected behaviour?
The text was updated successfully, but these errors were encountered: