You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No overload matches this call.
Overload 1 of 2, '(props: PolymorphicComponentProps<"native", FastOmit<FastOmit<Substitute<{ requiredAttr: boolean; } & { children?: ReactNode; }, { requiredAttr: boolean; } & { children?: ReactNode; }>, never>, never>, void, void, {}, {}>): Element', gave the following error.
Property 'requiredAttr' is missing in type '{ children: string; }' but required in type 'FastOmit<Substitute<FastOmit<FastOmit<Substitute<{ requiredAttr: boolean; } & { children?: ReactNode; }, { requiredAttr: boolean; } & { children?: ReactNode; }>, never>, never>, FastOmit<...>>, keyof ExecutionProps>'.
Overload 2 of 2, '(props: FastOmit<FastOmit<Substitute<{ requiredAttr: boolean; } & { children?: ReactNode; }, { requiredAttr: boolean; } & { children?: ReactNode; }>, never>, never>): ReactElement<...> | null', gave the following error.
Property 'requiredAttr' is missing in type '{ children: string; }' but required in type 'FastOmit<FastOmit<Substitute<{ requiredAttr: boolean; } & { children?: ReactNode; }, { requiredAttr: boolean; } & { children?: ReactNode; }>, never>, never>'.typescript(2769)
Steps to reproduce
Create a styled component with required props and set them with attrs using a props factory and you still have to define them again with attributes when using the component.
Expected Behavior
attrs() should work like documented and like it worked in v5
Actual Behavior
The required props have to be set again even if they've already been set by attrs using a props factory function (styled-components.com/docs/api#.attrs).
The text was updated successfully, but these errors were encountered:
@eramdam I literally have your same versions and I confirm it's not working, even copying their example. Probably they fixed into the web and not in native.
@eramdam I literally have your same versions and I confirm it's not working, even copying their example. Probably they fixed into the web and not in native.
Environment
System:
Binaries:
npmPackages:
Reproduction
I've created a codesandbox here: https://codesandbox.io/p/sandbox/styled-components-attrs-issue-forked-swv9k8
But the crux of it is this
Errors out on
<StyledStyledComponent>
withDetails
No overload matches this call.
Overload 1 of 2, '(props: PolymorphicComponentProps<"native", FastOmit<FastOmit<Substitute<{ requiredAttr: boolean; } & { children?: ReactNode; }, { requiredAttr: boolean; } & { children?: ReactNode; }>, never>, never>, void, void, {}, {}>): Element', gave the following error.
Property 'requiredAttr' is missing in type '{ children: string; }' but required in type 'FastOmit<Substitute<FastOmit<FastOmit<Substitute<{ requiredAttr: boolean; } & { children?: ReactNode; }, { requiredAttr: boolean; } & { children?: ReactNode; }>, never>, never>, FastOmit<...>>, keyof ExecutionProps>'.
Overload 2 of 2, '(props: FastOmit<FastOmit<Substitute<{ requiredAttr: boolean; } & { children?: ReactNode; }, { requiredAttr: boolean; } & { children?: ReactNode; }>, never>, never>): ReactElement<...> | null', gave the following error.
Property 'requiredAttr' is missing in type '{ children: string; }' but required in type 'FastOmit<FastOmit<Substitute<{ requiredAttr: boolean; } & { children?: ReactNode; }, { requiredAttr: boolean; } & { children?: ReactNode; }>, never>, never>'.typescript(2769)
Steps to reproduce
Create a styled component with required props and set them with attrs using a props factory and you still have to define them again with attributes when using the component.
Expected Behavior
attrs()
should work like documented and like it worked in v5Actual Behavior
The required props have to be set again even if they've already been set by attrs using a props factory function (styled-components.com/docs/api#.attrs).
The text was updated successfully, but these errors were encountered: