Skip to content

Property using declare prompts to add 'override' even though that does not seem valid #43566

@mjbvz

Description

@mjbvz

Bug Report

🔎 Search Terms

  • noImplicitOverride
  • static

🕗 Version & Regression Information

4.3.0-dev.20210406

💻 Code

Using --noImplicitOverride:

export class Foo{
    kind = 1;
}

class SubFoo extends Foo{
    declare kind: undefined;
}

🙁 Actual behavior

On declare kind: undefined, I see:

This member must have an 'override' modifier because it overrides a member in the base class 'Foo'

Adding override makes the code invalid

🙂 Expected behavior

We should probably change our code to:

class SubFoo extends Foo{
    override kind: undefined;
}

However using declare was previously valid and the current error message seems incorrect

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions