atlassian / atlassian/extract-react-types
Add converter for TSTypeOperator
- Dominant language
- JavaScript
- Stars
- 188
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
We have a complicated type that looks like:
```
// HtmlAttributes = AllHTMLAttributes - OnlyButtonProps
// We do this so onClick, and other props that overlap with html attributes,
// have the type defined by OnlyButtonProps.
type HtmlAttributes = Pick<
React.AllHTMLAttributes,
Exclude, keyof OnlyButtonProps>
>;
// This ends up being the Button prop API
type ButtonProps = HtmlAttributes & OnlyButtonProps
```
Running extract-react-types on this type throws the following error:
../packages/core/button/src/components/Button.tsx (../node_modules/extract-react-types-loader!../packages/core/button/src/components/Button.tsx)
Module build failed (from ../node_modules/extract-react-types-loader/index.js):
Error: Missing converter for: TSTypeOperator
It's pretty understandable something like this would not be supported by `extract-react-types`. This issue is really to discuss how type system specific features should (or shouldn't) be supported. My workaround at the moment is just creating a new file with a dummy component with the prop types I want extracted.
Maybe this highlights a need for a magic comment that `extract-react-types` will look for and extract if it exists.
Contributor guide
Assessment
This issue has not been assessed yet.