Skip to content

Impossible to define static 'length' function on class #442

Description

@hesselink

The following typescript program is accepted:

class C {
    static length ()  { return "twelve"; }
}

However, in the generated code:

var C = (function () {
    function C() {
    }
    C.length = function () {
        return "twelve";
    };
    return C;
})();

Here, an attempt is made to assign to the length property of a function. This doesn't work (at least in Firefox and Chrome), causing subsequent calls of C.length() to crash. Perhaps calling a static class function length should just be disallowed?

Migrated from codeplex issue #1260.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions