From fcec637f01c89b3a5f3ee92e72fbbc1b2c4c091f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 22 Sep 2026 10:36:03 +0000 Subject: [PATCH] :white_check_mark: Check the runtime member in every boolean/nullish handler --- src/tagged-union.test.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/tagged-union.test.ts b/src/tagged-union.test.ts index e3e1d26..7873b81 100644 --- a/src/tagged-union.test.ts +++ b/src/tagged-union.test.ts @@ -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