Skip to content
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

Cannot ref with Typescript #2202

Closed
lukepighetti opened this issue Nov 11, 2018 · 3 comments
Closed

Cannot ref with Typescript #2202

lukepighetti opened this issue Nov 11, 2018 · 3 comments

Comments

@lukepighetti
Copy link

lukepighetti commented Nov 11, 2018

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.

private _ref = React.createRef<HTMLDivElement>();

<SliderContainer
  ref={this._ref}
/>
const SliderContainer = styled.div`
  /* whatever */
`

screen_shot_2018-11-11_at_5 44 35_pm

Action: make a styled.div and ref it with React.createRef<HTMLDivElement>()
Expected behavior: it works
Actual behavior: type error

@kachkaev
Copy link
Member

Same here. Meanwhile using ref={_ref as any} 🤔

@kachkaev
Copy link
Member

kachkaev commented Nov 11, 2018

This repo do lo longer keeps typings for styled-components, so I guess the issue will be closed soon. @lukepighetti could you please recreate it in https://github.com/DefinitelyTyped/DefinitelyTyped if this has not been done yet?

@lukepighetti
Copy link
Author

Posted and ref'd the ref issue with a GitHub ref. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants