Easy
What is the result of compiling the following TypeScript code?
interface Animal {
name: string;
}
interface Dog extends Animal {
breed: string;
}
const myDog: Dog = {
name: 'Buddy',
breed: 'Labrador',
};
function printName(animal: Animal): void {
console.log(animal.name);
}
printName(myDog);
Author: Vincent CotroStatus: PublishedQuestion passed 711 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!
Similar QuestionsMore questions about Typescript
6
Create a generic reverseArray function to reverse the elements of an array while maintaining type safety.5
Define a custom type that represents a coordinate with an x and y property of type number in Typescript5
Import an add function from a TypeScript module math.ts4
Which of the following utility types makes all properties of a given type optional?4
Typescript: What is the type of result?