✅ Check the runtime member in every boolean/nullish handler

This commit is contained in:
tmu committed 2026-09-22 10:36:03 +00:00
1 parent f7b7a06f1a
commit fcec637f01
1 file changed
+16 -2
+16 -2
View File
@@ -216,8 +216,22 @@ test("getTaggedUnionMatcherW: boolean and nullish tags widen to the union", () =
assert.equal(s.kind, true); assert.equal(s.kind, true);
return "yes" as const; return "yes" as const;
}, },
false: () => 0 as const, false: (s) => {
null: () => null, 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 // Assert