✅ Check the runtime member in every boolean/nullish handler
This commit is contained in:
1 parent
f7b7a06f1a
commit
fcec637f01
1 file changed
+16
-2
@@ -216,8 +216,22 @@ test("getTaggedUnionMatcherW: boolean and nullish tags widen to the union", () =
|
||||
assert.equal(s.kind, true);
|
||||
return "yes" as const;
|
||||
},
|
||||
false: () => 0 as const,
|
||||
null: () => null,
|
||||
false: (s) => {
|
||||
expectTypeOf(s).toEqualTypeOf<{
|
||||
readonly kind: false;
|
||||
readonly b: number;
|
||||
}>();
|
||||
assert.equal(s.kind, false);
|
||||
return 0 as const;
|
||||
},
|
||||
null: (s) => {
|
||||
expectTypeOf(s).toEqualTypeOf<{
|
||||
readonly kind: null;
|
||||
readonly c: number;
|
||||
}>();
|
||||
assert.equal(s.kind, null);
|
||||
return null;
|
||||
},
|
||||
});
|
||||
|
||||
// Assert
|
||||
|
||||
Reference in new issue
Block a user