Skip to content

override keyword doesn't check symbol-key class members #57141

@whzx5byb

Description

@whzx5byb

🔎 Search Terms

override symbol
override symbol member
override in:title

🕗 Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play?#code/MYewdgzgLgBAZiEMC8MDKBPAtgIxAGwAoBKAbgFgAoYfAQwghgEEYBvKgXyqpvsYCEYAUwAeUIWAAmjFu0owFMEADchAJzUBLSUJgBtBCAC6JNjC6UOMIA

💻 Code

const foo = Symbol();
class A {
}

class B extends A {
    override [foo]() { }
} 

🙁 Actual behavior

It compiles.

🙂 Expected behavior

There should be an error: This member cannot have an 'override' modifier because it is not declared in the base class 'A'.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions