type-analyze
v0.0.0
Published
Statically analyze types through comments
Readme
type-analyze 
Statically analyze types through comments
// foo : Number -> Number
function foo (x) {
return x + 1
}
foo('Hello')
// TypeError: foo('Hello') doesnt match Number -> NumberThis module is a work in progress:
- [x]: Loads function type signature
- [x]: Checks literal types on function calls
- [ ]: Wildcards in type signature using
* - [ ]: Infers types of expressions (in functions and identifiers)
- [ ]: Loads identifier type signature
- [ ]: Checks identifier types
- [ ]: Proper support for scopes
Installation
$ npm install --save type-analyzeUsage
analyze(source, options) -> errors
Analyze source with options.
var errors = analyze(`
// foo : Number -> Number
function foo (x) { return x + 1 }
foo('Hello')
`)
console.error(errors)
// [ TypeError { ... } ]'errors'
An array of TypeError objects.
License
MIT © Jamen Marz
