้•œๅƒ็ซ™็‚น ยท ๆœฌ้กต็”ฑ็ฌฌไธ‰ๆ–น GitHub ๅช่ฏป้•œๅƒๆไพ›๏ผŒ้ž GitHub ๅฎ˜ๆ–น็ซ™็‚น๏ผŒไธๆŽฅๅ—ไปปไฝ•็™ปๅฝ•ๆˆ–ๅ‡ญๆฎ่พ“ๅ…ฅใ€‚ๅ‰ๅพ€ github.com
Skip to content

noImplicitOverride reports in JS files with checkJs enabled, can only ts-ignore the lineย #45591

Description

Bug Report

๐Ÿ”Ž Search Terms

override checkjs jsdoc

๐Ÿ•— Version & Regression Information

  • This changed between versions 4.2 and 4.3

โฏ Playground Link

Playground Link

๐Ÿ’ป Code

class Foo {
  method() {
    return 1234
  }
}

class Bar extends Foo {
  method() {
    return super.method() + 42;
  }
}

๐Ÿ™ Actual behavior

In my projects, I set checkJs to enforce that our non-TS files also typecheck. We also use the noImplicitOverride rule.

But, if you try to create a class with method overrides in JS files, you get the override errors, even though there doesn't appear to be a way to silence them except via // @ts-ignore.

๐Ÿ™‚ Expected behavior

noImplicitOverride is not reported in JS files (or, there's some JSDoc way to add it, like types can be).

Activity

  1. DanielRosenwasser commented on Aug 27, 2021

    @DanielRosenwasser
    Member

    You can add a JSDoc /** @override */ tag to get around this. The error message should be clearer in these cases.

  2. jakebailey commented on Aug 27, 2021

    @jakebailey
    MemberAuthor

    A quick fix like the ones for inferring types would be nice. Right now, all that's suggested is to add an ignore. (Not sure if those go here or vscode.)

  3. Kingwl commented on Aug 27, 2021

    @Kingwl
    Contributor

    AFAIK, TypeScript does not have good enough tools to handle jsdoc/comments yet. It's hard to add a jsdoc tag to something if there's already exists leading comments.

  4. a-tarasyuk commented on Aug 30, 2021

    @a-tarasyuk
    Contributor

    The issue is labeled "Domain: Error Messages". What should be the expected error message?

    /cc Daniel Rosenwasser (@DanielRosenwasser)

  5. DanielRosenwasser commented on Aug 30, 2021

    @DanielRosenwasser
    Member

    What should be the expected error message?

    Nathan Shively-Sanders (@sandersn) might have opinions but

    This member must have a leading JSDoc comment with an '@override' tag because it overrides a member in the base class 'Foo'.
    

    TypeScript does not have good enough tools to handle jsdoc/comments yet. It's hard to add a jsdoc tag to something if there's already exists leading comments.

    This is a good point. We would accept a PR that doesn't include a quick fix, but maybe Nathan also has some ideas there.

  6. Kingwl commented on Aug 31, 2021

    @Kingwl
    Contributor

    Here's a PR to try to add quickfix support in js file. https://github.com/Kingwl/TypeScript/pull/8/files.

  7. sandersn commented on Sep 3, 2021

    @sandersn
    Member

    It's hard to add a jsdoc tag to something if there's already exists leading comments.

    I believe inferFromUsage has code for this.

  8. DanielRosenwasser commented on Sep 3, 2021

    @DanielRosenwasser
    Member

    Wenlu Wang (@Kingwl) see if there's anything there you might be able to leverage for your current work, and let us know if you run into any issues.

  9. Kingwl commented on Sep 4, 2021

    @Kingwl
    Contributor

    I guess it's might helpful to Kevin Tan (@stkevintan).

  10. locked as resolved and limited conversation to collaborators on Oct 21, 2025
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 TypeScriptDomain: Error MessagesThe issue relates to error messagingDomain: JavaScriptThe issue relates to JavaScript specificallyDomain: LS: Quick FixesEditor-provided fixes, often called code actions.Help WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions