✨ Reject a fallback for an exhaustive map
A fallback paired with a handler map that already covers `T` was still accepted, even though its remainder is empty. Fold the guard into `Handled`'s own (F-bounded) constraint so it is checked after inference; a conditional in the fallback parameter is evaluated while `Handled` is still its constraint and rejects every partial map whose handler callbacks need contextual typing.
This commit is contained in:
1 parent
7e7f716424
commit
f27966e803
5 files changed
+65
-14
No files matched your search
+2
-2
@@ -44,8 +44,8 @@ Matcher:
|
||||
→ fold into `src/primitive.ts` / the public API; drop `src/prototype*.ts`
|
||||
✔ `_` should receive only the unhandled `T` keys, not all of `T` @medium @done
|
||||
→ the fallback is now a second argument: `(handlers, (s) => …)`, `s: Exclude<T, keyof handlers>`
|
||||
☐ A fallback for an already-exhaustive handler map must be a compile error @medium
|
||||
→ `(handlers, fallback)` with `handlers` covering all of `T` is accepted; the redundant fallback should be rejected (currying would allow the guard)
|
||||
✔ A fallback for an already-exhaustive handler map must be a compile error @medium @done
|
||||
→ rejected by an F-bounded constraint on `Handled` (checked *after* inference); a conditional in the fallback parameter is evaluated too early and breaks contextual typing
|
||||
|
||||
Bugs:
|
||||
✔ TS 7 LSP server logs `context canceled` on stderr at shutdown @done
|
||||
|
||||
Reference in new issue
Block a user