v1.2 • Dev Tools • 4kb gzipped • MIT
TypeGuardian
Runtime validation that infers its static types, so a schema is written exactly once.

// why typeguardian
One source of truth
Write the runtime schema and the static type is inferred from it. The two can never drift because there is only one.
// stack
Errors people can read
Failures report the path, the expected shape and the value that arrived, not a stack trace.
TypeGuardian started as a single file in a client project and stayed small on purpose. It does one job, it does it in 4kb gzipped, and it has no runtime dependencies.
Getting started
Install it, import it, call it:
npm i typeguardian-js
Write the runtime schema and the static type is inferred from it. The two can never drift because there is only one.
What it does not do
It does not manage your state, style your components or ship a plugin system. Those are your decisions, and keeping them out is what keeps the bundle honest.
- Inferred static types
- Path-accurate errors
- MIT licensed, commercially friendly
Features
Inferred static types
No duplicate interface to maintain beside the validator.
Path-accurate errors
Nested failures report the exact key path that failed.
Readable reports
Terminal output for humans, JSON for everything else.
ESM and types
Ships module and CommonJS builds with hand-written type definitions and source maps.
CI first
Exits with a meaningful status code and prints machine-readable output on request.
Config optional
Sensible defaults mean TypeGuardian does something useful before you configure anything.
Get TypeGuardian v1.2
7 files • .min.js 4kb • .zip 55kb • sha384 verified
Changelog
- Discriminated union support
- Path-accurate error messages
- Async refinement functions
- Fixed a memory leak on repeated teardown
- Source maps now published with every build
- Type definitions rewritten by hand
- Dropped the last runtime dependency
// related
Related products
ChartForge
Canvas charts in twelve lines. Responsive, accessible and dark-mode ready, with no D3 learning curve.
View →MotionEase
Physics-based micro-animations with a single call. Spring curves that feel right without a tuning session.
View →FormFlow
Validation and multi-step logic that works the same in React, Vue and vanilla. Your markup stays yours.
View →Wire it into CI today.
MIT licensed. Commercial friendly. Five-minute setup.