Microsoft/TypeScript

Function implementation name must be ... (2389) when abstract method is declared again later

Open

#61,783 opened on May 29, 2025

View on GitHub
ย (3 comments)ย (0 reactions)ย (0 assignees)TypeScriptย (48,455 stars)ย (6,726 forks)batch import
Domain: Error MessagesHelp WantedPossible Improvement

Description

๐Ÿ”Ž Search Terms

duplicate abstract function declaration, abstract method, missing implementation, abstract method overload

๐Ÿ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about abstract class

โฏ Playground Link

https://www.typescriptlang.org/play/?#code/IYIwzgLgTsDGEAJYBthjAgYge2wg3gFAIkKiQzwIBmArgHawAiApigIwAUAlAFwIA3bAEsAJgG5CxUnUasUAJh78Kw+gHMC00qSgsItKPQQByABbCT2hAF9r18tDiJZzNsi59BIiYTtA

๐Ÿ’ป Code

abstract class Foo {
    abstract func1(): void;

    func2(): string {
    // ^? Function implementation name must be 'func1'.(2389)
        return 'hi'
    }
    
    abstract func1(): void;
}

๐Ÿ™ Actual behavior

TS error reported for func2, which is valid.

๐Ÿ™‚ Expected behavior

TS error reported for func1, which has duplicated abstract declaration.

Additional information about the issue

No response

Contributor guide

Function implementation name must be ... (2389) when abstract method is declared again later ยท Microsoft/TypeScript#61783 | Good First Issue