Skip to content

Object literal getters in class bodies may no longer use the 'super' keyword #149

@sophiajt

Description

@sophiajt

According to the spec, 'super' is not valid inside of a object literal's accessors. This is now considered an error. To work around this, capture the class reference in a new variable outside of the object literal.

class F { public test(): string { return ""; } }
    class SuperObjectTest extends F {
        public testing() {
            var test = {
                get F() {
                    return super.test();
// !!! 'super' cannot be referenced here.
                }
            };
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangeWould introduce errors in existing codeBy DesignDeprecated - use "Working as Intended" or "Design Limitation" instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions