pick some type from interface typescript code example
Example 1: typescript type interface
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;
Example 2: typescript pick type from interface
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