Appearance
src/06-type-aliases.ts โ
From TS practice (practice/) ยท original: practice/src/06-type-aliases.ts ยท all files in this project
ts
type Point ={
x:number;
y:number;
};
let point: Point = {x:10, y:20};
//type vs interface
//interfaces can be extended, types cannot
interface Animal {
name: string;
}
interface Dog extends Animal {
breed: string;
}
let myDog: Dog = {
name: "Buddy",
breed: "Golden Doodle",
}