Replies: 1 comment
-
Could you use
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a simple variant like this:
This creates a type that says variants of
type
MUST bea | b | c | null | undefined
but I want to be able to pass an arbitrary string, if it doesn't match any existing variant, it shouldn't do anything.
But everything I've tried I'm getting an error:
Type 'string' is not assignable to type '"a" | "b" | "c" | null | undefined'.
unless I override it with
as any
but I'd rather not addany
's to my codebase.Is there any way to make the type for this particular variant less strong? So it can accept an arbitrary string?
Beta Was this translation helpful? Give feedback.
All reactions