Answers for "non-abstract class does not implement inherited abstract member typescript"

0

non-abstract class does not implement inherited abstract member typescript

// You need to mark fields and methods that are not implemented as abstract
abstract class AbstractService {
    abstract someMethod(): Observable<SomeType>
}

// This will also force implementing classes to actually implement the methods:

// Error: Non-abstract class 'Service' does not implement inherited abstract member 'someMethod' from class 'AbstractService'
class Service extends AbstractService{}

// ok, methods is implemented
class OkService extends AbstractService {
    someMethod() {
        throw new Error("Method not implemented.");
    }
}
Posted by: Guest on July-08-2021

Code answers related to "non-abstract class does not implement inherited abstract member typescript"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language