• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1type Diff<T extends keyof any, U extends keyof any> =
2    ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]
3type Omit<U, K extends keyof U> = Pick<U, Diff<keyof U, K>>
4type Omit1<U, K extends keyof U> = Pick<U, Diff<keyof U, K>>;
5// is in fact an equivalent of
6
7type Omit2<T, K extends keyof T> = {[P in Diff<keyof T, K>]: T[P]};
8
9type O = Omit<{ a: number, b: string }, 'a'>
10export const o: O = { b: '' }
11