Skip to content

super in object literal causes error #5441

Closed
@mrac

Description

@mrac

The following code should log:

original
new

as it does in ES6. Instead in TypeScript 1.6.2 it causes an error:

'super' can only be referenced in a derived class.

Here's the code:

var obj = {
    __proto__: {
        method() {
            console.log('original');
        }
    },
    method() {
        super.method();
        console.log('new');
    }
};

obj.method();

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptES6Relates to the ES6 SpecFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions