镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

super in object literal causes error #5441

Description

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();

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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