Skip to content

Unimplemented abstract methods result in verbose, repetitive messageΒ #57240

Closed
@ssalbdivad

Description

@ssalbdivad

πŸ”Ž Search Terms

abstract method verbose 18052

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://tsplay.dev/Wkz4lm

πŸ’» Code

abstract class A {
    abstract m1() : number;
    abstract m2() : number;
}

abstract class B extends A {
    abstract bm1() : number;
    abstract bm2() : number;
}


// The following error:
/*
Non-abstract class 'C' does not implement all abstract members of 'B'(18052)
input.ts(9, 14): Non-abstract class 'C' does not implement inherited abstract member 'bm1' from class 'B'.
input.ts(10, 14): Non-abstract class 'C' does not implement inherited abstract member 'bm2' from class 'B'.
input.ts(3, 14): Non-abstract class 'C' does not implement inherited abstract member 'm1' from class 'B'.
input.ts(4, 14): Non-abstract class 'C' does not implement inherited abstract member 'm2' from class 'B'.


Would be better expressed as one of the following (either of which could optionally
include a reference to B and/or A's declaration locations):


OPTION A:
Non-abstract class 'C' does not implement inherited abstract members 'bm1', 'bm2', 'm1', 'm2' from class 'B'.

OPTION B:
Non-abstract class 'C' does not implement inherited abstract members 'bm1', 'bm2' from class 'B'.
Non-abstract class 'C' does not implement inherited abstract members 'm1', 'm2' from class 'A'.
*/
class C extends B {

}

πŸ™ Actual behavior

Long, redundant error message

πŸ™‚ Expected behavior

Concise, readable error message

Additional information about the issue

The actual case in which I ran into this was significantly more verbose because the class had generic parameters whose constraints were expanded in the description.

This makes it very hard to actually see which properties are missing in a single location.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions