Function record

  • Creates a Record<Key, Value> or your custom record. By default, record() will widen the keys (K) you specified in the value to form Record<Widen<K>, V>.

    You can also override it by specifying a custom record, e.g.: record<{ a: number }>()

    Type Parameters

    • K extends string | number | symbol
    • V

    Parameters

    • Optionalvalue: Record<K, V>

    Returns Record<Widen<K>, V>

  • Type Parameters

    • R extends Record<any, any>

    Parameters

    • Optionalvalue: R

    Returns R