-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
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
StyledComponents, cannot ref #30451
Comments
Should be fixed by #30511 |
Nope, I still get this error when using the latest version (using |
Okay, I have tested it is due to |
Just passing props for https://codesandbox.io/s/styled-components-ref-typescript-error-9hs8t const StyledFoo = styled.div`
color: red;
`;
const Foo = (props: JSX.IntrinsicElements['div']) => {
return <StyledFoo {...props} />;
}; Line 12 there is the error on
|
Any updates on this? Still running into this error as well. |
it looks I fixed when using this type assertion |
Is this a duplicate issue (#28884)? |
This is related to |
@szyman that's because the issue is that styled-components doesn't expect a How I solved it:
By specifying |
I seem to be unable to ref Styled Components with Typescript. I have asked another user about this and they believe this is a bug so I have decided to file an issue.
Action: make a
styled.div
and ref it withReact.createRef<HTMLDivElement>()
Expected behavior: it works
Actual behavior: type error, but seems to work with
ref={this._ref as any}
The text was updated successfully, but these errors were encountered: