type-analyze

    0.0.0 • Public • Published

    type-analyze experimental

    Statically analyze types through comments

    // foo : Number -> Number
    function foo (x) {
      return x + 1
    }
     
    foo('Hello')
    // TypeError: foo('Hello') doesnt match Number -> Number

    This module is a work in progress:

    • [ ]: 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-analyze

    Usage

    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


    version travis downloads license follow

    Install

    npm i type-analyze

    DownloadsWeekly Downloads

    3

    Version

    0.0.0

    License

    MIT

    Last publish

    Collaborators

    • npm