DefinitelyTyped / DefinitelyTyped/DefinitelyTyped
[styled-components] forwardRef types are broken when using styled component
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 51.4k
- Forks
- 30.4k
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 108
Description
- I tried using the
@types/xxxxpackage and had problems. - I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
- I understand that
@typespackage versions do not follow SemVer. - Mention the authors (see
Definitions by:inindex.d.ts) so they can respond.- Authors: @Igorbek @Igmat @LavaToaster @Jessidhia @JKillian @eps1lon @flavordaaave @wagerfield @Lazyuki @mgoszcz2 @danilofuchs
I have build a small codesandbox to expose the problem:
https://codesandbox.io/s/lucid-hypatia-g9umr?file=/src/Icon.tsx
I'm a beginner in typescript so it's possible i miss something but i feel it strange that i works perfectly when i use directly the <svg/> but when i use <Svg> but I can not get it to work.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox, especially /src/Icon.tsx, and reproduce the type error using the styled component with forwardRef. Compare it with the direct case; done means the styled-component usage type-checks correctly with the same ref and props behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100