TS1245
Method 'updates' cannot have an implementation because it is marked abstract.
Broken Code ❌
abstract class Base {
abstract updates(): void {
console.log('Updating...');
}
}This error occurs because an abstract method cannot have an implementation. Abstract methods must only define a method signature and must be implemented in derived classes.
Fixed Code ✔️
Remove the implementation in the abstract class and let derived classes implement the method:
abstract class Base {
abstract updates(): void;
}
class Derived extends Base {
updates(): void {
console.log('Updating...');
}
}
const derived = new Derived();
derived.updates();