— Typescript — 1 min read
1type Readonly<T> = { readonly [P in keyof T]: T[P] };2type Partial<T> = { [P in keyof T]?: T[P] };
name과 age가 필수인 UserType을 PUT이나 PATCH 등 Optional property를 가진 DTO로 만드려면
1interface UserType {2 name: string;3 age: number;4}56interface CreateUserType extends Partial<UserType> {}