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
where I'm trying to set props on Typography component, depending of an error props of an UnstyledLabel.
Here, all type are passed, and should be properly inferred, but I'm getting this error:
Error:(12, 3) TS2345: Argument of type '({ error }: { error: boolean; }) => { variant: string; as: string; }' is not assignable to parameter of type '{ variant: string; as: string; } | Injector<{ error: boolean; }, { variant: string; as: string; }>'.
Type '({ error }: { error: boolean; }) => { variant: string; as: string; }' is not assignable to type 'Injector<{ error: boolean; }, { variant: string; as: string; }>'.
Types of parameters '__0' and 'props' are incompatible.
Type '{ error: boolean; } | undefined' is not assignable to type '{ error: boolean; }'.
Type 'undefined' is not assignable to type '{ error: boolean; }'.
For me it's because of the ? in react-with-props/src/index.ts:12: type Injector<Props, InjectedProps> = (props?: Props) => InjectedProps.
How can I solve my problem?
Thanks.
Matt'
The text was updated successfully, but these errors were encountered:
Hi @mathieutu, I'd like to reproduce your issue, could you let me know which version of TypeScript you're using and what package (and package version) Typography belongs to?
Typography is a basic component on my own which accept variant and as as props. And here the problem doesn't come from the passed component but from the injected props. (See my code ref, which provoke the undefined)
Hi,
thank's for this package.
I have an issue with
withProps
typing.I have this piece of code:
where I'm trying to set props on
Typography
component, depending of anerror
props of an UnstyledLabel.Here, all type are passed, and should be properly inferred, but I'm getting this error:
For me it's because of the
?
inreact-with-props/src/index.ts:12
:type Injector<Props, InjectedProps> = (props?: Props) => InjectedProps
.How can I solve my problem?
Thanks.
Matt'
The text was updated successfully, but these errors were encountered: