[[Union]] 타입에서 특정 요소들을 뽑아서 새로운 Union 타입을 생성할 수 있다. 예제 1) ```typescript type Shape = | { kind: "circle"; radius: number } | { kind: "square"; x: number } | { kind: "triangle"; x: number; y: number }; type T2 = Extract<Shape, { kind: "circle" } | { kind: "square" }> // type T2 = { kind: "circle"; radius: number; } | {kind: "square"; x: number} ``` Shape 이라는 [[Discriminated Union]]에서 `circle`, `square` 의 구분자를 갖고 있는 요소들을 뽑아서 새롭게 `T2` 라는 타입을 생성한다. 예제 2) ```typescript type Routes = "/users" | "/users/:id" | "/products" | "/products/:id"; type DynamicRoutes = Extract<Routes, `${string}:${string}`>; // "/users/:id" | "/products/:id" ``` 두번째 타입인자에 [[Template literal type]] 를 넘겨서 새로운 Union 타입을 생성할 수 있다. --- 참조 강의: https://inf.run/FVDi