@elliots/typical 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -352,6 +352,10 @@ The generated validation code is optimised for runtime performance:
|
|
|
352
352
|
|
|
353
353
|
- **Reusable validators** - When the same type is validated multiple times, Typical hoists the validation logic to a reusable function at module scope. Nested types that appear in multiple places (e.g., `Address` used in both `User` and `Company`) are also extracted and reused.
|
|
354
354
|
- **Smart redundancy elimination** - Skips validation when returning values that are already known to be valid: validated parameters, properties of validated objects, variables assigned from casts or `JSON.parse`, and aliased variables
|
|
355
|
+
- **Cross-file call graph analysis** - Analyses the entire project to eliminate redundant validation across files:
|
|
356
|
+
- **Trusted return values** - If a function validates its return type, callers don't re-validate the result
|
|
357
|
+
- **Internal function parameters** - Non-exported functions only called with pre-validated arguments skip parameter validation
|
|
358
|
+
- **Chained function calls** - When `step2(step1(user))` is called, validation flows through the chain
|
|
355
359
|
- **Type-aware dirty tracking** - Tracks when validated values might become invalid. Primitives stay valid after being passed to functions (they're copied), but objects are re-validated if passed to unknown functions. Pure functions (listed in the config) like `console.log` don't invalidate objects.
|
|
356
360
|
- **Union early bail-out** - Union type checks use if-else chains so the first matching type succeeds immediately
|
|
357
361
|
- **Skip comments** - Add `// @typical-ignore` before a function to skip all validation for it
|
|
@@ -478,3 +482,18 @@ Runtime validation performance comparing Typical vs Zod vs no validation:
|
|
|
478
482
|
|
|
479
483
|
- **vs Nothing**: Speed relative to no validation or filtering (1.0x = same speed)
|
|
480
484
|
- **vs Zod**: Speed relative to Zod (1.0x = same speed)
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## Changelog
|
|
489
|
+
|
|
490
|
+
<!-- CHANGELOG_START -->
|
|
491
|
+
|
|
492
|
+
### v0.3.0 (2026-01-14)
|
|
493
|
+
|
|
494
|
+
- Build call graph across whole project to avoid validating already-validated data
|
|
495
|
+
- Source map vis in the playround
|
|
496
|
+
- Add 'never' support, the property must not exist
|
|
497
|
+
- Fix: Node 24
|
|
498
|
+
|
|
499
|
+
<!-- CHANGELOG_END -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliots/typical",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Runtime safe TypeScript transformer using typia",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"runtime",
|
|
@@ -40,19 +40,27 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"commander": "14.0.2",
|
|
43
|
-
"@elliots/typical-compiler": "0.
|
|
43
|
+
"@elliots/typical-compiler": "0.3.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "22",
|
|
47
47
|
"c8": "10.1.3",
|
|
48
|
+
"nano-staged": "^0.9.0",
|
|
48
49
|
"oxfmt": "^0.21.0",
|
|
49
50
|
"oxlint": "1.36.0",
|
|
50
51
|
"oxlint-tsgolint": "0.10.1",
|
|
52
|
+
"simple-git-hooks": "^2.13.1",
|
|
51
53
|
"typescript": "5.9.3"
|
|
52
54
|
},
|
|
53
55
|
"peerDependencies": {
|
|
54
56
|
"typescript": "^5.0.0"
|
|
55
57
|
},
|
|
58
|
+
"simple-git-hooks": {
|
|
59
|
+
"pre-commit": "pnpm nano-staged"
|
|
60
|
+
},
|
|
61
|
+
"nano-staged": {
|
|
62
|
+
"*.{js,ts,tsx,jsx,json,md,html,css}": "oxfmt"
|
|
63
|
+
},
|
|
56
64
|
"engines": {
|
|
57
65
|
"pnpm": ">=10"
|
|
58
66
|
},
|