-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
As each instances are defined as branded type of the extended enum (#7), type guards should be supported.
enum _Fruit { Apple, Orange }
class Fruit extends extend<typeof _Fruit, _Fruit>(_Fruit) {}
declare const f: Fruit;
if (f === Fruit.Apple) {
type T = typeof f; // should be Fruit.Apple, it is not working now regardless of type guards
}
if (f.is(Fruit.Apple)) {
type T = typeof f; // Fruit.Apple
}
if (f.is.not(fruit.Apple)) {
type T = typeof f; // Exclude<F, Fruit.Apple> or something similar
}
Metadata
Metadata
Assignees
Labels
No labels