✅ Reject a mismatched strict fallback
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`.
This commit is contained in:
1 parent
c7223dbe69
commit
935e82d205
1 file changed
+2
@@ -307,6 +307,8 @@ test("getMatcher factory rejects patterns outside its contract", () => {
|
|||||||
});
|
});
|
||||||
// @ts-expect-error a gap without a `_` fallback is not exhaustive
|
// @ts-expect-error a gap without a `_` fallback is not exhaustive
|
||||||
factory({ a: () => 1 });
|
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", () => {
|
test("getMatcherW factory rejects patterns outside its contract", () => {
|
||||||
|
|||||||
Reference in new issue
Block a user