TS1029

error TS1029: ‘public’ modifier must precede ‘abstract’ modifier.

Bad Code ❌

1
2
3
abstract class Animal {
abstract public makeNoise(): string;
}

Fixed Code ✔️

They keywords public, private, and protected define the access to a class member. Access modifiers have to be defined first in TypeScript.

Solution 1:

1
2
3
abstract class Animal {
public abstract makeNoise(): string;
}

Solution 2:

The visibility is public by default, so you don’t have to explicitly declare it:

1
2
3
abstract class Animal {
abstract makeNoise(): string;
}

Video: https://youtu.be/62J_eQsK0e0?t=531