TS2741
error TS2741: Property ‘name’ is missing in type ‘{}’ but required in type ‘Animal’.
Broken Code ❌
1 |
|
Fixed Code ✔️
Interfaces can be used with classes or plain objects. If we want our object (i.e. laika
) to fulfill the contract of Animal
, we have to assign all required properties to it:
1 |
|