File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 1- // Omit<K,T > : Omit은 Pick과 반대로 특정 타입을 생략해서 사용할 수 있다.
2-
1+ // Exclude<T1,T2 > : Exclude는 Omit과 Pick과는 달리 속성이 아닌 특정 타입(num,string)을 지정해서 제외하면 사용할 수 있다.
2+ // -- data.interface 참조
33import {
44 GradeType , ScoreType , User
5- } from "./utils/data.interface"
6-
7- const admin : Omit < User , "age" | "gender" > = {
8- id : 0 ,
9- name : 'Bob' ,
10- }
5+ } from "./utils/data.interface"
Original file line number Diff line number Diff line change @@ -91,4 +91,9 @@ export interface ScoreTemp {
9191}
9292
9393export type GradeType = '1' | '2' | '3' | '4' ;
94- export type ScoreType = 'A' | 'B' | 'C' | 'D' ;
94+ export type ScoreType = 'A' | 'B' | 'C' | 'D' ;
95+
96+ //Exclude
97+ type T1 = string | number ;
98+ //T1은 Exclude이다. 따라 T1의 유니온으로 지정된 number를 제외하고 string만 사용하는 것이다.
99+ type T2 = Exclude < T1 , number > ;
You can’t perform that action at this time.
0 commit comments