๐ย Reference
๐ย Chapter
Omit<T,K>
T
์์ ๋ชจ๋ ํ๋กํผํฐ๋ฅผ ์ ํํ ๋ค์ย K
๋ฅผ ์ ๊ฑฐํ ํ์
์ ๊ตฌ์ฑํ๋ค.
์์ 1
interface Todo {
title: string;
description: string;
completed: boolean;
}
type TodoPreview = Omit<Todo, 'description'>;
const todo: TodoPreview = {
title: 'Clean room',
completed: false,
};
์์ 2
interface Product {
id: number;
name: string;
price: number;
brand: string;
stock: number;
}
type shoppingItem = Omit<Product, "stock">;
const apple: Omit<Product, "stock"> = {
id: 1,
name: "red apple",
price: 1000,
brand: "del"
};