✅ 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
This commit is contained in:
1 parent
08384bbc82
commit
e5df17310e
5 files changed
+69
-2
No files matched your search
@@ -55,6 +55,7 @@
|
||||
"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",
|
||||
|
||||
Reference in new issue
Block a user