paldepind / union-type

A small JavaScript library for defining and using union types.
MIT License
478 stars 28 forks source link

check Boolean constructor with isBoolean #15

Closed raine closed 9 years ago

raine commented 9 years ago

couldn't pass false as value for [Boolean]

> var Type = require('union-type')
> Type({ Exists: [Boolean] }).Exists(true)
[ true,
  of: { Exists: [Function], case: [Function], caseOn: [Function] },
  name: 'Exists' ]
> Type({ Exists: [Boolean] }).Exists(false)
TypeError: wrong value false passed to location 0 in Exists
paldepind commented 9 years ago

That is an accidental omission! Thanks you for catching it.