notmytype
notmytype provides a type-asserting function that handles multiple arguments and uses the type asserter from flowcheck.
Install
In your project, run:
npm install notmytype --save
or install from the GitHub repo:
npm install ludios/notmytype --save
Examples
notmytype requires io.js 2.0.0+/node 4.0.0+ running with --harmony-rest-parameters
.
const T = ;
All of these examples type-check without error:
;;;;;;;;;;;;;;;;
T()
raises TypeError
if given an object of the wrong type:
> T([3, "s"], T.list(T.number))
TypeError: First object: Expected an instance of number; got "s", context: Array<number> / 1
See assert.js and test/assert.js for details.