Type alias Expand<T>

Expand<T>: T extends infer O
    ? {
        [K in keyof O]: O[K]
    }
    : never

Expand will expand an object type by rebuilding the object at the point it is used. which can be useful when the type is obscured due to utility types and you want to see the underlying type that is expected.

  • This can be very useful when a type is confusing at first glance, if it is using utilities like Extract, Pick, Omit, extends, etc then Expand will unwrap that into a coherent/flat type you can understand.

Type Parameters

  • T

Example

 // the ExpandedCandle can be hovered to see the properties of IDEXCandle directly
type ExpandedCandle = Expand<IDEXCandle>;