2d3577716dff62c5f3259930fb6a4b9e708ff63a
The fallback is now the second factory argument — `(handlers, (s) => …)` — so its parameter is `Exclude<T, keyof handlers>`. A property's contextual type is fixed before TypeScript infers its sibling keys, so the remainder is not expressible while the fallback sits in the handler map; a later argument is contextually typed from inference on an earlier one. Both factories take the new shape; the tests and autocomplete probes follow. The generic overloads guard excess keys with type-fest's `Exact`, so the error lands on the offending property. A redundant fallback (a full handler map plus one) is still accepted — the guard for it does not survive inference and is left to its backlog task.
tiny-pattern-ts
Pattern matching for TypeScript/ESM environments (F#-style, not regex).
Description
tiny-pattern-ts brings F#-style pattern matching to TypeScript. Patterns are
ordinary objects whose matches method is a TypeScript type guard, so narrowing
composes the way any other guard does. It is deliberately not a regex engine and
not a macro: there is no transpiler and no DSL to learn, and the type-level
contract is the feature — see development/library.md
for the design decisions and the known limitations.
Requirements
- Node.js >= 26 (
enginesfield; pinned via.node-version). - TypeScript >= 5.0 to consume the published declarations. The emitted
.d.tsuseconsttype parameters (TS 5.0) and keep their relative.tsspecifiers; both resolve on TS >= 5.0 innode10/node16/nodenext/bundler. - The package is ESM-only (no CommonJS shim).
API
Yet to be implemented
License
MIT © 2025 tmu. See LICENSE.
Contributing
Contributions are documented in CONTRIBUTING.md; the reasons behind the project's decisions, rejected alternatives, and known issues live in development/. AI coding agents start at AGENTS.md.