• Utility Type - 4

    → K 유형의 속성을 제외하고 T의 속성을 사용하여 유형을 구성합니다.

    → omit은 pick 과 반대로 원하는 것을 빼버리는 설정을 할 수 있다. 즉 빼고자 하는 것이 더 명확하다면 Omit 사용

    /**
     * *Construct a type with the properties of T except for those in type K.*
     */
    type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
    
    /**
     * *Exclude from T those types that are assignable to U*
     */
    type Exclude<T, U> = T extends U ? never : T;
    *// -> U에 할당할 수 있는 유형을 T에서 제외*
    
    type Video = {
      id: string;
      title: string;
      url: string;
      data: string;
    };
    
    type VideoMetadata = Omit<Video, 'url' | 'data' | 'TT'>;
    *// 내가 빼고싶은 타입들만 쏙쏙 빼고 나머지 타입만 사용할 때*
    *// +
    // 객체안에 없는 타입도 뺄 수 있다.*
    
    function getVideo(id: string): Video {
      return {
        id,
        title: 'video',
        url: 'https://..',
        data: 'byte-data..',
      };
    };
    
    function getVideoMetadata(id: string): VideoMetadata {
      return {
        id: id,
        title: 'title',
      };
    };