필수 유틸리티 타입
// Partial + Required 조합
type UpdateUser = Partial<User> & Required<Pick<User, "id">>;
// Record로 맵 타입 생성
type StatusMap = Record<"active" | "inactive" | "banned", User[]>;
// Extract/Exclude
type SuccessEvents = Extract<Event, { type: "success" }>;커스텀 유틸리티 타입
type DeepPartial<T> = {
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
};
type NonNullableFields<T> = {
[P in keyof T]: NonNullable<T[P]>;
};
댓글 0