Check an object against predefined schema.
Sample typings definition:
{
name: 'string',
age: 'number',
height: 'number?',
isDeveloper: 'boolean',
birthDate: 'date|number',
address: {
country: 'string?',
city: 'string',
},
posts: [{
title: 'string'
}, true],
}
It supports:
- primitive types -
string
,number
,boolean
,date
, andundefined
- optional types, defined with
?
- union types, defined with
|
- array types, defined as
[arrayItemType, canArrayBeUndefined]