TS1070

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

Broken 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 Tutorial