Changelog
v3.1.0
t.Integer
to standard typest.Type
to standard typesinterface
combinator, fix #195, docs (thanks @ctrlplusb)
strict
option for structs and interfaces, fix #203, docsmixin()
now allows identical references for overlapping propertiesChangelog
v3.0.0
Warning. If you don't rely in your codebase on the property maybe(MyType)(undefined) === null
this is not a breaking change for you.
Maybe
constructor from altering the value when Nil
, fix #183 (thanks @gabro)Changelog
v2.7.0
lib/fromJSON
module: generic deserialize, fix #169lib/fromJSON
TypeScript definition fileStruct.extend
functions, fix #177 (thanks @Firfi)Changelog
v2.6.0
declare
API: recursive and mutually recursive types (thanks @utaal)t.struct.extend
, fix #164 (thanks @dzdrazil)predicate
field to irreducibles meta objectsChangelog
v2.5.2
Changelog
v2.5.1
t.update
should not change the reference when no changes occur, fix #153Changelog
v2.5.0
refinement
alias to subtype
(which is deprecated), fix #140getDefaultName
on combinator constructorsChangelog
v2.4.0
update
function, #127dispatch
implementation now handles unions of unions, #126Changelog
v2.3.0
New Feature
The messages now have the following general form:
Invalid value <value> supplied to <context>
where context is a slash-separated string with the following properties:
<field name>: <field type>
Note: for more readable messages remember to give types a name
Example:
var Person = t.struct({
name: t.String
}, 'Person'); // <- remember to give types a name
var User = t.struct({
email: t.String,
profile: Person
}, 'User');
var mynumber = t.Number('a');
// => Invalid value "a" supplied to Number
var myuser = User({ email: 1 });
// => Invalid value 1 supplied to User/email: String
myuser = User({ email: 'email', profile: { name: 2 } });
// => Invalid value 2 supplied to User/profile: Person/name: String