Typanion
Type-safe runtime type validation with no dependencies
ts
import * ast from 'typanion';ÂconstisPort =t .cascade (t .isNumber (), [t .isInteger (),t .isInInclusiveRange (1, 65535),]);Âif (isPort (value )) {server .listen (value );}
ts
import * ast from 'typanion';ÂconstisPort =t .cascade (t .isNumber (), [t .isInteger (),t .isInInclusiveRange (1, 65535),]);Âif (isPort (value )) {server .listen (value );}
TypeScript integration
Typanion provides strong type inference; if your validator functions pass, TypeScript will refine values accordingly.
Feature complete
Despite being very small, Typanion supports error messages, coercions, and various utilities outside of pure JSON validation.
Tree-shakeable
Typanion uses a functional approach that lends itself very well to being optimized away by most bundlers.