IT/typescript31 TS - Exclude<T, U> 개념 한마디로, T에서 U를 제외시킨 Type U를 제외시킬 수 없다면 T 그대로 리턴 T에 union type 받을 수 있음 type Exclude = T extends U ? never : T Examples Only number type numberOnly = Exclude const a: numberOnly = 5 // const a: number how it works Exclude => Exclude | Exclude => string | never => => string Remove props in interface interface Student { name: string age: number address: string gpa: number } type refiendStudent = Ex.. 2023. 6. 27. 이전 1 ··· 3 4 5 6 다음