types-kit.get.md

September 4, 2023 ยท View on GitHub

Home > types-kit > Get

Get type

Get the specified value from T.

Signature:

export type Get<T, K extends Keys<T>> = T[K]

References: Keys

Example

 interface Props {
      a?: number
      b: string
      c: boolean
    }

 // Expect: number | string | undefined
 type PropValues = Get<Props, 'a' | 'b'>