Files
tiny-pattern-ts/package.json
T
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

74 lines
2.4 KiB
JSON

{
"name": "tiny-pattern-ts",
"version": "0.0.0",
"description": "Pattern matching for TypeScript/ESM environments (F#-style, not regex)",
"keywords": [
"pattern-matching",
"pattern",
"match",
"algebraic-data-types",
"adt",
"typescript"
],
"repository": {
"type": "git",
"url": "https://github.com/tmueller/tiny-pattern-ts.git"
},
"license": "MIT",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md",
"LICENSE"
],
"scripts": {
"build": "tsc -p tsconfig.build.json",
"check": "npm run check:oxlint && npm run check:oxfmt && npm run check:tsc && npm run check:cspell && npm run check:package && npm run check:outdated",
"check:cspell": "cspell .",
"check:outdated": "check-outdated",
"check:oxfmt": "oxfmt --check src",
"check:oxlint": "oxlint src",
"check:package": "sort-package-json --check",
"check:tsc": "tsc --noEmit",
"clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
"fix:oxfmt": "oxfmt src",
"fix:oxlint": "oxlint --fix src",
"fix:package": "sort-package-json --write",
"test": "npm run check:tsc && node --test --experimental-strip-types --no-warnings src/",
"test:ci": "c8 --reporter=text --reporter=lcov --reporter=html node --test --experimental-strip-types --no-warnings src/",
"test:unit": "node --test --experimental-strip-types --no-warnings src/",
"use:git-commit-message": "cp commit-message-template .git/COMMIT_EDITMSG || true"
},
"devDependencies": {
"@oxfmt/binding-linux-x64-musl": "^0.66.0",
"@oxlint/binding-linux-x64-musl": "^1.81.0",
"@types/node": "^22.10.0",
"c8": "^10.1.3",
"check-outdated": "^2.13.0",
"cspell": "^8.19.3",
"expect-type": "1.4.0",
"lefthook": "^1.11.12",
"oxfmt": "^0.66.0",
"oxlint": "^1.81.0",
"sort-package-json": "^3.1.0",
"tslib": "^2.8.1",
"type-fest": "^4.40.1",
"typescript": "^7.0.2"
},
"engines": {
"node": ">=22.6"
},
"publishConfig": {
"access": "public"
}
}