📝 Refresh license year, backlog notes and JSDoc
Bump the copyright to 2026 in LICENSE and README, add the comparison-section notes to the backlog, and trim the primitive-union factory JSDoc now that the universe rules live in README § Caveats.
This commit is contained in:
1 parent
c878e60ff2
commit
38484aa16d
4 files changed
+9
-8
No files matched your search
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 tmu
|
||||
Copyright (c) 2026 tmu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -141,7 +141,7 @@ cover. The type-level cost of supporting open universes is recorded in
|
||||
|
||||
## License
|
||||
|
||||
MIT © 2025 tmu. See [LICENSE](./LICENSE).
|
||||
MIT © 2026 tmu. See [LICENSE](./LICENSE).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ Documentation:
|
||||
→ previous Examples order: literal/exhaustive, typeof, structural/discriminated unions, when, any
|
||||
☐ Create `examples/` directory with runnable snippets
|
||||
☐ Add comparison section vs. other TS pattern-matching libs in Readme.md
|
||||
☐ Why do we do this? => exhaustiveness encoded type safe
|
||||
☐ Why this form? little syntax, data last, very small, autocomplete, strict typing in the handler; for more features use ts-pattern
|
||||
☐ Write migration guide for users coming from discriminated unions
|
||||
☐ Create backlog tasks for implementation
|
||||
☐ Validate code fences in Markdown (start with README.md) — compile the TypeScript examples against `src/` so the docs cannot drift from the API
|
||||
|
||||
@@ -97,16 +97,15 @@ const dispatch =
|
||||
);
|
||||
|
||||
/**
|
||||
* Create a matcher for a finite primitive universe, with one common return type.
|
||||
* Create a matcher for a finite primitive universe, with one common return
|
||||
* type.
|
||||
*
|
||||
* Use it when the value itself is the union (`"yes" | "no"`) and every handler
|
||||
* returns the same type.
|
||||
*
|
||||
* The universe `T` must be a finite union of literals with no
|
||||
* value/stringification collision: broad members (`string`, `number`, template
|
||||
* literals) and `true | "true"` / `1 | "1"` are rejected at the call site. The
|
||||
* returned builder takes a handler map keyed by the members; supplying a second
|
||||
* fallback argument allows a partial map and receives the unhandled remainder.
|
||||
* The returned builder takes a handler map keyed by the members; supplying a
|
||||
* second fallback argument allows a partial map and receives the unhandled
|
||||
* remainder.
|
||||
*
|
||||
* @typeParam T - The finite universe of primitive members to match.
|
||||
* @returns A builder for the handler map, or the handler map plus a fallback.
|
||||
|
||||
Reference in new issue
Block a user