|
1 |
| -import type {BuiltIns} from './internal'; |
| 1 | +import type {BuiltIns, UnknownRecord} from './internal'; |
2 | 2 |
|
3 | 3 | /**
|
4 | 4 | @see PartialDeep
|
@@ -69,17 +69,17 @@ export type PartialDeep<T, Options extends PartialDeepOptions = {}> = T extends
|
69 | 69 | ? PartialReadonlyMapDeep<KeyType, ValueType, Options>
|
70 | 70 | : T extends ReadonlySet<infer ItemType>
|
71 | 71 | ? PartialReadonlySetDeep<ItemType, Options>
|
72 |
| - : T extends object |
73 |
| - ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156 |
| 72 | + : T extends UnknownRecord |
| 73 | + ? PartialObjectDeep<T, Options> |
| 74 | + : T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156 |
74 | 75 | ? Options['recurseIntoArrays'] extends true
|
75 | 76 | ? ItemType[] extends T // Test for arrays (non-tuples) specifically
|
76 | 77 | ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
|
77 | 78 | ? ReadonlyArray<PartialDeep<ItemType | undefined, Options>>
|
78 | 79 | : Array<PartialDeep<ItemType | undefined, Options>>
|
79 | 80 | : PartialObjectDeep<T, Options> // Tuples behave properly
|
80 | 81 | : T // If they don't opt into array testing, just use the original type
|
81 |
| - : PartialObjectDeep<T, Options> |
82 |
| - : unknown; |
| 82 | + : T; |
83 | 83 |
|
84 | 84 | /**
|
85 | 85 | Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
|
0 commit comments