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
Doesn't work:
import { TextfieldProps } from './types'; const Textfield = forwardRef((props: TextfieldProps, ref) => { ^^^^^^^^^^^^^^^ not extracted return <input />; }); Textfield.displayName = 'Textfield'; export default memo(Textfield);
import { TextfieldProps } from './types'; const Textfield = forwardRef<unknown, TextfieldProps>((props: TextfieldProps, ref) => { ^^^^^^^^^^^^^^^ not extracted return <input />; }); Textfield.displayName = 'Textfield'; export default memo(Textfield);
Works
import { TextfieldProps } from './types'; const Textfield = forwardRef((props: TextfieldProps, ref) => { return <input />; }); Textfield.displayName = 'Textfield'; export default memo<TextfieldProps>(Textfield); ^^^^^^^^^^^^^^^ extracts, but now missing ref prop in the component types
The text was updated successfully, but these errors were encountered:
Yeah that's a bit of a weird one.
I think case one and two both work without the memo. We'll need to add some additional smarts to get it to work with it though.
memo
This should work if you wrap a typed forwardRef in an untyped memo. Not ideal, just sharing incase you were blocked 😄
forwardRef
import React, { forwardRef, memo } from 'react'; type MyComponentProps = { foo: string, } const MyComponent = memo(forwardRef<HTMLElement, MyComponentProps>((props, ref) => { return <span>Foo</span>; })); export default MyComponent;
(https://github.com/atlassian/extract-react-types/blob/master/packages/extract-react-types/converters-typescript.test.js#L656)
Sorry, something went wrong.
No branches or pull requests
Doesn't work:
Doesn't work:
Works
The text was updated successfully, but these errors were encountered: