tmu e5df17310e ✅ Add expect-type for type-level tests
- Install expect-type@1.4.0 (devDependency)
- New src/index.test.ts exercises the public API with both runtime
  assertions (node:assert/strict inside node:test) and type-level
  assertions (expectTypeOf().toEqualTypeOf, toMatchTypeOf, toHaveProperty)
- Tests are excluded from tsc -p tsconfig.build.json (no .d.ts pollution
  in dist/)
- Type-level checks happen during tsc --noEmit (run by 'npm run check' and
  the test script); expectTypeOf assertions have no runtime side effect,
  so they pair naturally with node --test in the same test() blocks
- cspell: add EDITMSG to dictionary (used in commit-message-template path)
- oxlint test-file overrides: silence no-nodejs-modules (we use node:
  builtins) and no-magic-numbers (literals in tests are fine)

Coverage:
- match() returns a builder with with/exhaustive/otherwise
- P.literal narrows to its literal type, P.type to its typeof target
- exhaustive() returns the union of handler return types
- otherwise() falls back when no case matches
- exhaustive() throws when no case matches
2026-09-03 10:39:15 +00:00
2026-09-03 10:39:15 +00:00
2026-02-02 13:38:42 +01:00
2026-09-03 10:28:08 +00:00
2026-02-02 13:38:42 +01:00
2026-09-03 10:39:15 +00:00
2026-09-03 10:28:08 +00:00
2025-04-29 13:43:07 +02:00
2026-09-03 10:39:15 +00:00

tiny-pattern-ts

Pattern matching for TypeScript/ESM environments (F#-style, not regex).

Development

  • Build: npm run build
  • Test: npm run test, npm run test:ci
  • Checks: npm run check, npm run fix
  • Format/Fix: npm run fix:oxfmt, npm run fix:oxlint

Tooling

  • TypeScript 7 — type checker and build (tsc).
  • node --test + --experimental-strip-types — test runner (Node 22.6+, flag dropped on Node 24).
  • c8 — code coverage for test:ci.
  • oxlint — Rust-based linter.
  • oxfmt — Rust-based formatter (Prettier-compatible).
  • cspell — spell checking.
  • sort-package-json — keep package.json keys alphabetized.
  • lefthook — git pre-commit hooks.

Requirements

  • Node.js >= 22.6 (>= 24 recommended; --experimental-strip-types is unflagged on 24).

VSCode integration

  • Recommended extensions: see .vscode/extensions.json (oxc, cspell).
  • TypeScript 7 is used via typescript.tsdk pointing at node_modules/typescript/lib.
  • oxc extension provides oxlint squiggles and oxfmt format-on-save.

Workflows

  • Version updates via npm version.
  • Publishing via GitHub Actions on tagged commits (see .github/workflows/ci.yml).
  • Changesets is available as a devDependency for changelog automation if desired.

Contribution guidelines

  • Commit signing (GPG).
  • Set up commit message template: npm run use:git-commit-message.
  • See commit-message-template.
  • Type-only tests use expect-type's expectTypeOf(...) inside node --test cases.
S
Description
No description provided
Readme MIT
1.5 MiB
0 Stars 1 Watchers 0 Forks
0.9.0
Latest
2026-09-29 23:57:54 +02:00
Languages
TypeScript 88.4%
Shell 9.9%
Dockerfile 1.7%