TS1070

TS1070: ‘private’ modifier cannot appear on a type member.

Bad Code ❌

1
2
3
interface Animal {
private name: string;
}

Fixed Code ✔️

Interfaces are structures that define the public contract. This prohibits you from using private modifiers. Only public and protected can be used. To solve the problem, the private keyword must be removed from the name property of the Animal interface:

1
2
3
interface Animal {
name: string;
}

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