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

Ref is working with icons, but is not present on Icon type #78

Open
filingroove opened this issue Dec 20, 2020 · 3 comments
Open

Ref is working with icons, but is not present on Icon type #78

filingroove opened this issue Dec 20, 2020 · 3 comments

Comments

@filingroove
Copy link

I'm moving a project to TypeScript and I can't use ref :)

The code:

<Info size={ 14 } color="#BDC1C7" ref={ infoIcon } />

The compiler error:

Type error: Type '{ size: number; color: string; ref: MutableRefObject<SVGElement>; }' is not assignable to type 'IntrinsicAttributes & Props & { children?: ReactNode; }'.
  Property 'ref' does not exist on type 'IntrinsicAttributes & Props & { children?: ReactNode; }'. Did you mean 'href'?

Not sure what type to use for forwardRef function component, but seems like FC doesn't include any ref property 🤔

@filingroove
Copy link
Author

filingroove commented Dec 20, 2020

Got it working by adding ref?: RefObject<SVGElement>

@filingroove filingroove changed the title Ref if working with icons, but is not present on Icon type Ref is working with icons, but is not present on Icon type Dec 21, 2020
@rformato
Copy link

Having the same issue

@tounsoo
Copy link

tounsoo commented Apr 6, 2024

Same here

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

3 participants