Skip to content

Option to Output Type Annotations for Google Closure Compiler #137

@eeasley

Description

@eeasley

I think it would be lovely if gorillascript (optionally) output its type annotations in comments formatted for the Google Closure Compiler. Users could then use the GCC to perform static type checking on their code.

So

let increment(x as Number) x + 1

would compile to something like

/**
 * @param {number} x
 */
function increment(x) {
    if (typeof x !== "number") {
        throw new TypeError("Expected x to be a Number, got " + __typeof(x));
    }
        return x + 1;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions