Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 669 Bytes

File metadata and controls

34 lines (24 loc) · 669 Bytes

Home > types-kit > ObjectEntry

ObjectEntry type

return the type of that object's entry.

Signature:

export type ObjectEntry<T extends object> = [
  Keys<T> extends infer K
    ? T extends readonly unknown[]
      ? K extends number
        ? K
        : never
      : K
    : never,
  T[Keys<T>],
]

References: Keys

Example

type Foo = { a:1, b:2 }

// Expect: ['a' | 'b', 1 | 2]
type EntryType = ObjectEntry<Foo>