interface Todo { title: string; description: string; completed: boolean;}
type TodoPreview = Pick<Todo, "title" | "completed">;
const todo: TodoPreview = { title: "Clean room", completed: false,};
todo; const todo: TodoPreviewTry
//INTERFACE TYPE
interface Animal { type Animal = {
name: string; name: string;
} }
interface Bear extends Animal { type Bear = Animal & {
honey: boolean; honey: Boolean;
} }
const bear = getBear(); const bear = getBear();
bear.name; bear.name;
bear.honey; bear.honey;
const modal = {} as IModal;
interface I1 {
x: any;
}
interface I2 {
y: {
a: I1,
b: I1,
c: I1
}
z: any
}
let myVar: I2['y']; // indexed access type