Ninguern
How to properly type the `mergeProps` with Typescript?
I'm using the
mergeProps
function to enter some default props for my component, but this is causing a Typescript error because some properties that are using string literals are being replaced with just type string
.
<button
is trowing an error because p.type
is now typed as a string.
Type 'string' is not assignable to type '"button" | "submit" | "reset" | undefined'.
getButtonStyles
is trowing an error because p.variant
is now a string instead of ButtonVariant.
Argument of type 'string' is not assignable to parameter of type 'ButtonVariant'.Is there a way where I can type this to solve this issue?
3 replies