Recursively transforms an object type T into a type where all properties are replaced with their corresponding primitive types.
T
type Actual = { a: 'a'; b: 85; c: true; d: { e: 'xxxxxxxxxxx'; f: 'eeeeeeeeeeeeeeeeee'; g: { h: 1000000000000000; i: undefined; j: null; }; };};type Expected = { a: string; b: number; c: boolean; d: { e: string; f: string; g: { h: number; i: undefined; j: null; }; };};type Result = DeepToPrimitive<Actual>; // Expected Copy
type Actual = { a: 'a'; b: 85; c: true; d: { e: 'xxxxxxxxxxx'; f: 'eeeeeeeeeeeeeeeeee'; g: { h: 1000000000000000; i: undefined; j: null; }; };};type Expected = { a: string; b: number; c: boolean; d: { e: string; f: string; g: { h: number; i: undefined; j: null; }; };};type Result = DeepToPrimitive<Actual>; // Expected
Example
Recursively transforms an object type
T
into a type where all properties are replaced with their corresponding primitive types.