✅ 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
+2
-1
@@ -12,7 +12,8 @@
|
||||
"nocheck",
|
||||
"oxfmtrc",
|
||||
"oxlintrc",
|
||||
"sortpackagerc"
|
||||
"sortpackagerc",
|
||||
"EDITMSG"
|
||||
],
|
||||
"ignorePaths": ["dist", "node_modules", "public", "coverage", "*.svg"]
|
||||
}
|
||||
Reference in new issue
Block a user