Reputation: 665
Exporting Props from a React.Component is easy enough, but how do you properly extract the types the Component is actually using, once defaultProps
are taken into account? I imagine you could omit keys from Props and then merge with a Partial of defaultProps, but are there any built-in ways of this? Flow accomplishes this with React.ElementConfig
Upvotes: 1
Views: 636
Reputation: 30999
You are looking for:
JSX.LibraryManagedAttributes<typeof MyComponent, MyComponent["props"]>
Upvotes: 2