ChildUpdateFields
Helper for calculating the nested fields for a given type T1. This is needed
to distribute union types such as undefined | {...}
(happens for optional
props) or {a: A} | {b: B}
.
In this use case, V
is used to distribute the union types of T[K]
on
Record
, since T[K]
is evaluated as an expression and not distributed.
See https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types
type ChildUpdateFields<K extends string, V> = V extends Record<string, unknown> ? AddPrefixToKeys<K, UpdateData<V>> : never;
§Type
§
V extends Record<string, unknown> ? AddPrefixToKeys<K, UpdateData<V>> : never
[src]