From 935e82d205a8947bbf107efc8c6b1245602dca29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 18 Sep 2026 23:37:44 +0000 Subject: [PATCH] :white_check_mark: Reject a mismatched strict fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The factory-contract test now also covers a fallback whose return does not fit the common return of the handler map — a `number` handler with a `string` fallback — which `getMatcherW` accepts as `number | string`. --- src/primitive.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/primitive.test.ts b/src/primitive.test.ts index c222fe2..b9d10ae 100644 --- a/src/primitive.test.ts +++ b/src/primitive.test.ts @@ -307,6 +307,8 @@ test("getMatcher factory rejects patterns outside its contract", () => { }); // @ts-expect-error a gap without a `_` fallback is not exhaustive factory({ a: () => 1 }); + // @ts-expect-error a `string` fallback does not fit the `number` handler + factory({ a: () => 1 }, () => "x"); }); test("getMatcherW factory rejects patterns outside its contract", () => {