Add types for props from .attrs and "as"#4291
Add types for props from .attrs and "as"#4291bjornsnoen wants to merge 3 commits intostyled-components:mainfrom
Conversation
|
I use your branch locally to test the .attrs issue in my project, but the #4076 issue still happening to me:
My Icon component: My Icon is a SVG. It happens with my other component which is styled.text too. What I find strange is that when instantiating the component with styled components, the .attrs is not correctly reading the component's typing, even if I determine that it is mandatory, autocomplete only shows it as optional, and does not report an error in the time to instantiate. |
|
@carloslibardo could you format your comment properly using github code markdown and give the definition for the Icon component and I can take a look? |
|
@bjornsnoen i updated the comment with more infos |
|
I ended up taking the other PR, can you check to see if your issue is resolved with current |
|
Even if #4288 solves the |
| Optional< | ||
| PrivateResolvedTarget extends KnownTarget | ||
| ? Substitute< | ||
| Substitute<OuterProps, React.ComponentPropsWithRef<PrivateResolvedTarget>>, |
There was a problem hiding this comment.
Using ComponentPropsWithRef after importing it with import type { ComponentPropsWithRef } from 'react'; would improve readability, I think.
|
Hey, any chances someone has knowledge and time to pick up this PR ? Especially since the #4288 has been reverted |
|
Would love to see this picked up as well |
Fixes:
Noticed that someone else opened PR #4288 yesterday, I will assume that their fix for
attrsis more correct than mine but I'll leave this until that PR is merged or other wise addressed.