Skip to content

Missing error on overloaded methods with mismatched computed namedΒ #52329

@dragomirtitian

Description

@dragomirtitian

Bug Report

πŸ”Ž Search Terms

mismatched overload names

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

class Person {
    ["B"](a: number): string;
    ["A"](a: string|number): number | string {
      return 0;
    }
}
let p = new Person();
p.A(0)

// Runtime erorr
p.B(0)

πŸ™ Actual behavior

Runtime error, on p.B since that member does not actually exist.

πŸ™‚ Expected behavior

Compile time error when declaring overloads on methods with computed names and the overload names don't match

Notes

  • Seems to happen with other types of computed properties such as symbols.
  • Was not found in actual code I was just tinkering with isolatedDeclarations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions