Type guards: support true & (maybe is X)
#31021
Labels
Duplicate
An existing issue was already created
true & (maybe is X)
#31021
Search Terms
type guards union assert
Suggestion
I'd like to be able to define a type guard's return type as
true & (maybe is X)
and have any statements after calling the type guard function recognize that the value is of the correct type.
Technically
false & (maybe is X)
should probably be supported also if this is implemented, but that isn't in my particular use case.Use Cases
The use case is an assertion helper
I'd like to be able to use
maybe
after the call since the Assertion will throw if the value is not of the right type..
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: