|
| 1 | +import type {ConditionalSimplifyDeep} from './conditional-simplify'; |
| 2 | +import type {OmitIndexSignature} from './omit-index-signature'; |
| 3 | +import type {PickIndexSignature} from './pick-index-signature'; |
| 4 | +import type {EnforceOptional} from './enforce-optional'; |
| 5 | +import type {Merge} from './merge'; |
| 6 | +import type { |
| 7 | + ArrayTail, |
| 8 | + FirstArrayElement, |
| 9 | + IsBothExtends, |
| 10 | + NonEmptyTuple, |
| 11 | + UnknownArrayOrTuple, |
| 12 | + UnknownRecord, |
| 13 | +} from './internal'; |
| 14 | + |
| 15 | +/** |
| 16 | +Deeply smplifies an object excluding iterables and functions. Used internally to improve the UX and accept both interfaces and type aliases as inputs. |
| 17 | +*/ |
| 18 | +type SimplifyDeep<Type> = ConditionalSimplifyDeep<Type, Function | Iterable<unknown>, object>; |
| 19 | + |
| 20 | +/** |
| 21 | +Try to merge two record properties or return the source property value, preserving `undefined` properties values in both cases. |
| 22 | +*/ |
| 23 | +type MergeDeepRecordProperty< |
| 24 | + Destination, |
| 25 | + Source, |
| 26 | + Options extends MergeDeepInternalOptions, |
| 27 | +> = undefined extends Source |
| 28 | + ? MergeDeepOrReturn<Source, Exclude<Destination, undefined>, Exclude<Source, undefined>, Options> | undefined |
| 29 | + : MergeDeepOrReturn<Source, Destination, Source, Options>; |
| 30 | + |
| 31 | +/** |
| 32 | +Walk through the union of the keys of the two objects and test in which object the properties are defined. |
| 33 | +- If the source does not contain the key, the value of the destination is returned. |
| 34 | +- If the source contains the key and the destination does not contain the key, the value of the source is returned. |
| 35 | +- If both contain the key, try to merge according to the chosen {@link MergeDeepOptions options} or return the source if unable to merge. |
| 36 | +*/ |
| 37 | +type DoMergeDeepRecord< |
| 38 | + Destination extends UnknownRecord, |
| 39 | + Source extends UnknownRecord, |
| 40 | + Options extends MergeDeepInternalOptions, |
| 41 | +> = EnforceOptional<{ |
| 42 | + [Key in keyof Destination | keyof Source]: Key extends keyof Source |
| 43 | + ? Key extends keyof Destination |
| 44 | + ? MergeDeepRecordProperty<Destination[Key], Source[Key], Options> |
| 45 | + : Source[Key] |
| 46 | + : Key extends keyof Destination |
| 47 | + ? Destination[Key] |
| 48 | + : never; |
| 49 | +}>; |
| 50 | + |
| 51 | +/** |
| 52 | +Wrapper around {@link DoMergeDeepRecord} which preserves index signatures. |
| 53 | +*/ |
| 54 | +type MergeDeepRecord< |
| 55 | + Destination extends UnknownRecord, |
| 56 | + Source extends UnknownRecord, |
| 57 | + Options extends MergeDeepInternalOptions, |
| 58 | +> = DoMergeDeepRecord<OmitIndexSignature<Destination>, OmitIndexSignature<Source>, Options> |
| 59 | +& Merge<PickIndexSignature<Destination>, PickIndexSignature<Source>>; |
| 60 | + |
| 61 | +/** |
| 62 | +Pick the rest type. |
| 63 | +
|
| 64 | +@example |
| 65 | +``` |
| 66 | +type Rest1 = PickRestType<[]>; // => [] |
| 67 | +type Rest2 = PickRestType<[string]>; // => [] |
| 68 | +type Rest3 = PickRestType<[...number[]]>; // => number[] |
| 69 | +type Rest4 = PickRestType<[string, ...number[]]>; // => number[] |
| 70 | +type Rest5 = PickRestType<string[]>; // => string[] |
| 71 | +``` |
| 72 | +*/ |
| 73 | +type PickRestType<Type extends UnknownArrayOrTuple> = number extends Type['length'] |
| 74 | + ? ArrayTail<Type> extends [] ? Type : PickRestType<ArrayTail<Type>> |
| 75 | + : []; |
| 76 | + |
| 77 | +/** |
| 78 | +Omit the rest type. |
| 79 | +
|
| 80 | +@example |
| 81 | +``` |
| 82 | +type Tuple1 = OmitRestType<[]>; // => [] |
| 83 | +type Tuple2 = OmitRestType<[string]>; // => [string] |
| 84 | +type Tuple3 = OmitRestType<[...number[]]>; // => [] |
| 85 | +type Tuple4 = OmitRestType<[string, ...number[]]>; // => [string] |
| 86 | +type Tuple5 = OmitRestType<[string, boolean[], ...number[]]>; // => [string, boolean[]] |
| 87 | +type Tuple6 = OmitRestType<string[]>; // => [] |
| 88 | +``` |
| 89 | +*/ |
| 90 | +type OmitRestType<Type extends UnknownArrayOrTuple, Result extends UnknownArrayOrTuple = []> = number extends Type['length'] |
| 91 | + ? ArrayTail<Type> extends [] ? Result : OmitRestType<ArrayTail<Type>, [...Result, FirstArrayElement<Type>]> |
| 92 | + : Type; |
| 93 | + |
| 94 | +// Utility to avoid picking two times the type. |
| 95 | +type TypeNumberOrType<Type extends UnknownArrayOrTuple> = Type[number] extends never ? Type : Type[number]; |
| 96 | + |
| 97 | +// Pick the rest type (array) and try to get the intrinsic type or return the provided type. |
| 98 | +type PickRestTypeFlat<Type extends UnknownArrayOrTuple> = TypeNumberOrType<PickRestType<Type>>; |
| 99 | + |
| 100 | +/** |
| 101 | +Try to merge two array/tuple elements or return the source element if the end of the destination is reached or vis-versa. |
| 102 | +*/ |
| 103 | +type MergeDeepArrayOrTupleElements< |
| 104 | + Destination, |
| 105 | + Source, |
| 106 | + Options extends MergeDeepInternalOptions, |
| 107 | +> = Source extends [] |
| 108 | + ? Destination |
| 109 | + : Destination extends [] |
| 110 | + ? Source |
| 111 | + : MergeDeepOrReturn<Source, Destination, Source, Options>; |
| 112 | + |
| 113 | +/** |
| 114 | +Merge two tuples recursively. |
| 115 | +*/ |
| 116 | +type DoMergeDeepTupleAndTupleRecursive< |
| 117 | + Destination extends UnknownArrayOrTuple, |
| 118 | + Source extends UnknownArrayOrTuple, |
| 119 | + DestinationRestType, |
| 120 | + SourceRestType, |
| 121 | + Options extends MergeDeepInternalOptions, |
| 122 | +> = Destination extends [] |
| 123 | + ? Source extends [] |
| 124 | + ? [] |
| 125 | + : MergeArrayTypeAndTuple<DestinationRestType, Source, Options> |
| 126 | + : Source extends [] |
| 127 | + ? MergeTupleAndArrayType<Destination, SourceRestType, Options> |
| 128 | + : [ |
| 129 | + MergeDeepArrayOrTupleElements<FirstArrayElement<Destination>, FirstArrayElement<Source>, Options>, |
| 130 | + ...DoMergeDeepTupleAndTupleRecursive<ArrayTail<Destination>, ArrayTail<Source>, DestinationRestType, SourceRestType, Options>, |
| 131 | + ]; |
| 132 | + |
| 133 | +/** |
| 134 | +Merge two tuples recursively taking into account a possible rest element. |
| 135 | +*/ |
| 136 | +type MergeDeepTupleAndTupleRecursive< |
| 137 | + Destination extends UnknownArrayOrTuple, |
| 138 | + Source extends UnknownArrayOrTuple, |
| 139 | + Options extends MergeDeepInternalOptions, |
| 140 | +> = [ |
| 141 | + ...DoMergeDeepTupleAndTupleRecursive<OmitRestType<Destination>, OmitRestType<Source>, PickRestTypeFlat<Destination>, PickRestTypeFlat<Source>, Options>, |
| 142 | + ...MergeDeepArrayOrTupleElements<PickRestType<Destination>, PickRestType<Source>, Options>, |
| 143 | +]; |
| 144 | + |
| 145 | +/** |
| 146 | +Merge an array type with a tuple recursively. |
| 147 | +*/ |
| 148 | +type MergeTupleAndArrayType< |
| 149 | + Tuple extends UnknownArrayOrTuple, |
| 150 | + ArrayType, |
| 151 | + Options extends MergeDeepInternalOptions, |
| 152 | +> = Tuple extends [] |
| 153 | + ? Tuple |
| 154 | + : [ |
| 155 | + MergeDeepArrayOrTupleElements<FirstArrayElement<Tuple>, ArrayType, Options>, |
| 156 | + ...MergeTupleAndArrayType<ArrayTail<Tuple>, ArrayType, Options>, |
| 157 | + ]; |
| 158 | + |
| 159 | +/** |
| 160 | +Merge an array into a tuple recursively taking into account a possible rest element. |
| 161 | +*/ |
| 162 | +type MergeDeepTupleAndArrayRecursive< |
| 163 | + Destination extends UnknownArrayOrTuple, |
| 164 | + Source extends UnknownArrayOrTuple, |
| 165 | + Options extends MergeDeepInternalOptions, |
| 166 | +> = [ |
| 167 | + ...MergeTupleAndArrayType<OmitRestType<Destination>, Source[number], Options>, |
| 168 | + ...MergeDeepArrayOrTupleElements<PickRestType<Destination>, PickRestType<Source>, Options>, |
| 169 | +]; |
| 170 | + |
| 171 | +/** |
| 172 | +Merge a tuple with an array type recursively. |
| 173 | +*/ |
| 174 | +type MergeArrayTypeAndTuple< |
| 175 | + ArrayType, |
| 176 | + Tuple extends UnknownArrayOrTuple, |
| 177 | + Options extends MergeDeepInternalOptions, |
| 178 | +> = Tuple extends [] |
| 179 | + ? Tuple |
| 180 | + : [ |
| 181 | + MergeDeepArrayOrTupleElements<ArrayType, FirstArrayElement<Tuple>, Options>, |
| 182 | + ...MergeArrayTypeAndTuple<ArrayType, ArrayTail<Tuple>, Options>, |
| 183 | + ]; |
| 184 | + |
| 185 | +/** |
| 186 | +Merge a tuple into an array recursively taking into account a possible rest element. |
| 187 | +*/ |
| 188 | +type MergeDeepArrayAndTupleRecursive< |
| 189 | + Destination extends UnknownArrayOrTuple, |
| 190 | + Source extends UnknownArrayOrTuple, |
| 191 | + Options extends MergeDeepInternalOptions, |
| 192 | +> = [ |
| 193 | + ...MergeArrayTypeAndTuple<Destination[number], OmitRestType<Source>, Options>, |
| 194 | + ...MergeDeepArrayOrTupleElements<PickRestType<Destination>, PickRestType<Source>, Options>, |
| 195 | +]; |
| 196 | + |
| 197 | +/** |
| 198 | +Merge mode for array/tuple elements. |
| 199 | +*/ |
| 200 | +type ArrayMergeMode = 'spread' | 'replace'; |
| 201 | + |
| 202 | +/** |
| 203 | +Test if it sould spread top-level arrays. |
| 204 | +*/ |
| 205 | +type ShouldSpread<Options extends MergeDeepInternalOptions> = Options['spreadTopLevelArrays'] extends false |
| 206 | + ? Options['arrayMergeMode'] extends 'spread' ? true : false |
| 207 | + : true; |
| 208 | + |
| 209 | +/** |
| 210 | +Merge two arrays/tuples according to the chosen {@link MergeDeepOptions.arrayMergeMode arrayMergeMode} option. |
| 211 | +*/ |
| 212 | +type DoMergeArrayOrTuple< |
| 213 | + Destination extends UnknownArrayOrTuple, |
| 214 | + Source extends UnknownArrayOrTuple, |
| 215 | + Options extends MergeDeepInternalOptions, |
| 216 | +> = ShouldSpread<Options> extends true |
| 217 | + ? Array<Exclude<Destination, undefined>[number] | Exclude<Source, undefined>[number]> |
| 218 | + : Source; // 'replace' |
| 219 | + |
| 220 | +/** |
| 221 | +Merge two arrays recursively. |
| 222 | +
|
| 223 | +If the two arrays are multi-level, we merge deeply, otherwise we merge the first level only. |
| 224 | +
|
| 225 | +Note: The `[number]` accessor is used to test the type of the second level. |
| 226 | +*/ |
| 227 | +type MergeDeepArrayRecursive< |
| 228 | + Destination extends UnknownArrayOrTuple, |
| 229 | + Source extends UnknownArrayOrTuple, |
| 230 | + Options extends MergeDeepInternalOptions, |
| 231 | +> = Destination[number] extends UnknownArrayOrTuple |
| 232 | + ? Source[number] extends UnknownArrayOrTuple |
| 233 | + ? Array<MergeDeepArrayOrTupleRecursive<Destination[number], Source[number], Options>> |
| 234 | + : DoMergeArrayOrTuple<Destination, Source, Options> |
| 235 | + : Destination[number] extends UnknownRecord |
| 236 | + ? Source[number] extends UnknownRecord |
| 237 | + ? Array<SimplifyDeep<MergeDeepRecord<Destination[number], Source[number], Options>>> |
| 238 | + : DoMergeArrayOrTuple<Destination, Source, Options> |
| 239 | + : DoMergeArrayOrTuple<Destination, Source, Options>; |
| 240 | + |
| 241 | +/** |
| 242 | +Merge two array/tuple recursively by selecting one of the four strategies according to the type of inputs. |
| 243 | +
|
| 244 | +- tuple/tuple |
| 245 | +- tuple/array |
| 246 | +- array/tuple |
| 247 | +- array/array |
| 248 | +*/ |
| 249 | +type MergeDeepArrayOrTupleRecursive< |
| 250 | + Destination extends UnknownArrayOrTuple, |
| 251 | + Source extends UnknownArrayOrTuple, |
| 252 | + Options extends MergeDeepInternalOptions, |
| 253 | +> = IsBothExtends<NonEmptyTuple, Destination, Source> extends true |
| 254 | + ? MergeDeepTupleAndTupleRecursive<Destination, Source, Options> |
| 255 | + : Destination extends NonEmptyTuple |
| 256 | + ? MergeDeepTupleAndArrayRecursive<Destination, Source, Options> |
| 257 | + : Source extends NonEmptyTuple |
| 258 | + ? MergeDeepArrayAndTupleRecursive<Destination, Source, Options> |
| 259 | + : MergeDeepArrayRecursive<Destination, Source, Options>; |
| 260 | + |
| 261 | +/** |
| 262 | +Merge two array/tuple according to {@link MergeDeepOptions.recurseIntoArrays recurseIntoArrays} option. |
| 263 | +*/ |
| 264 | +type MergeDeepArrayOrTuple< |
| 265 | + Destination extends UnknownArrayOrTuple, |
| 266 | + Source extends UnknownArrayOrTuple, |
| 267 | + Options extends MergeDeepInternalOptions, |
| 268 | +> = Options['recurseIntoArrays'] extends true |
| 269 | + ? MergeDeepArrayOrTupleRecursive<Destination, Source, Options> |
| 270 | + : DoMergeArrayOrTuple<Destination, Source, Options>; |
| 271 | + |
| 272 | +/** |
| 273 | +Try to merge two objects or two arrays/tuples recursively into a new type or return the default value. |
| 274 | +*/ |
| 275 | +type MergeDeepOrReturn< |
| 276 | + DefaultType, |
| 277 | + Destination, |
| 278 | + Source, |
| 279 | + Options extends MergeDeepInternalOptions, |
| 280 | +> = SimplifyDeep<[undefined] extends [Destination | Source] |
| 281 | + ? DefaultType |
| 282 | + : Destination extends UnknownRecord |
| 283 | + ? Source extends UnknownRecord |
| 284 | + ? MergeDeepRecord<Destination, Source, Options> |
| 285 | + : DefaultType |
| 286 | + : Destination extends UnknownArrayOrTuple |
| 287 | + ? Source extends UnknownArrayOrTuple |
| 288 | + ? MergeDeepArrayOrTuple<Destination, Source, Merge<Options, {spreadTopLevelArrays: false}>> |
| 289 | + : DefaultType |
| 290 | + : DefaultType>; |
| 291 | + |
| 292 | +/** |
| 293 | +MergeDeep options. |
| 294 | +
|
| 295 | +@see {@link MergeDeep} |
| 296 | +*/ |
| 297 | +export type MergeDeepOptions = { |
| 298 | + /** |
| 299 | + Merge mode for array and tuple. |
| 300 | +
|
| 301 | + When we walk through the properties of the objects and the same key is found and both are array or tuple, a merge mode must be chosen: |
| 302 | + - `replace`: Replaces the destination value by the source value. This is the default mode. |
| 303 | + - `spread`: Spreads the destination and the source values. |
| 304 | +
|
| 305 | + See {@link MergeDeep} for usages and examples. |
| 306 | +
|
| 307 | + Note: Top-level arrays and tuples are always spread. |
| 308 | +
|
| 309 | + @default 'spread' |
| 310 | + */ |
| 311 | + arrayMergeMode?: ArrayMergeMode; |
| 312 | + |
| 313 | + /** |
| 314 | + Whether to affect the individual elements of arrays and tuples. |
| 315 | +
|
| 316 | + If this option is set to `true` the following rules are applied: |
| 317 | + - If the source does not contain the key, the value of the destination is returned. |
| 318 | + - If the source contains the key and the destination does not contain the key, the value of the source is returned. |
| 319 | + - If both contain the key, try to merge according to the chosen {@link MergeDeepOptions.arrayMergeMode arrayMergeMode} or return the source if unable to merge. |
| 320 | +
|
| 321 | + @default false |
| 322 | + */ |
| 323 | + recurseIntoArrays?: boolean; |
| 324 | +}; |
| 325 | + |
| 326 | +/** |
| 327 | +Internal options. |
| 328 | +*/ |
| 329 | +type MergeDeepInternalOptions = Merge<MergeDeepOptions, {spreadTopLevelArrays?: boolean}>; |
| 330 | + |
| 331 | +/** |
| 332 | +Merge default and internal options with user provided options. |
| 333 | +*/ |
| 334 | +type DefaultMergeDeepOptions<Options extends MergeDeepOptions> = Merge<{ |
| 335 | + arrayMergeMode: 'replace'; |
| 336 | + recurseIntoArrays: false; |
| 337 | + spreadTopLevelArrays: true; |
| 338 | +}, Options>; |
| 339 | + |
| 340 | +/** |
| 341 | +This utility selects the correct entry point with the corresponding default options. This avoids re-merging the options at each iteration. |
| 342 | +*/ |
| 343 | +type MergeDeepWithDefaultOptions<Destination, Source, Options extends MergeDeepOptions> = SimplifyDeep< |
| 344 | +[undefined] extends [Destination | Source] |
| 345 | + ? never |
| 346 | + : Destination extends UnknownRecord |
| 347 | + ? Source extends UnknownRecord |
| 348 | + ? MergeDeepRecord<Destination, Source, DefaultMergeDeepOptions<Options>> |
| 349 | + : never |
| 350 | + : Destination extends UnknownArrayOrTuple |
| 351 | + ? Source extends UnknownArrayOrTuple |
| 352 | + ? MergeDeepArrayOrTuple<Destination, Source, DefaultMergeDeepOptions<Options>> |
| 353 | + : never |
| 354 | + : never |
| 355 | +>; |
| 356 | + |
| 357 | +/** |
| 358 | +Merge two objects or two arrays/tuples recursively into a new type. |
| 359 | +
|
| 360 | +- Properties that only exist in one object are copied into the new object. |
| 361 | +- Properties that exist in both objects are merged if possible or replaced by the one of the source if not. |
| 362 | +- Top-level arrays and tuples are always spread. |
| 363 | +- By default, inner arrays and tuples are replaced. See {@link MergeDeepOptions.arrayMergeMode arrayMergeMode} option to change this behaviour. |
| 364 | +- By default, individual array/tuple elements are not affected. See {@link MergeDeepOptions.recurseIntoArrays recurseIntoArrays} option to change this behaviour. |
| 365 | +
|
| 366 | +@example |
| 367 | +``` |
| 368 | +import type {MergeDeep} from 'type-fest'; |
| 369 | +
|
| 370 | +type Foo = { |
| 371 | + life: number; |
| 372 | + items: string[]; |
| 373 | + a: {b: string; c: boolean; d: number[]}; |
| 374 | +}; |
| 375 | +
|
| 376 | +interface Bar { |
| 377 | + name: string; |
| 378 | + items: number[]; |
| 379 | + a: {b: number; d: boolean[]}; |
| 380 | +} |
| 381 | +
|
| 382 | +type FooBar = MergeDeep<Foo, Bar>; |
| 383 | +// { |
| 384 | +// life: number; |
| 385 | +// name: string; |
| 386 | +// items: number[]; |
| 387 | +// a: {b: number; c: boolean; d: boolean[]}; |
| 388 | +// } |
| 389 | +
|
| 390 | +type FooBar = MergeDeep<Foo, Bar, {arrayMergeMode: 'spread'}>; |
| 391 | +// { |
| 392 | +// life: number; |
| 393 | +// name: string; |
| 394 | +// items: (string | number)[]; |
| 395 | +// a: {b: number; c: boolean; d: (number | boolean)[]}; |
| 396 | +// } |
| 397 | +``` |
| 398 | +
|
| 399 | +@example |
| 400 | +``` |
| 401 | +import type {MergeDeep} from 'type-fest'; |
| 402 | +
|
| 403 | +// Merge two arrays |
| 404 | +type ArrayMerge = MergeDeep<string[], number[]>; // => (string | number)[] |
| 405 | +
|
| 406 | +// Merge two tuples |
| 407 | +type TupleMerge = MergeDeep<[1, 2, 3], ['a', 'b']>; // => (1 | 2 | 3 | 'a' | 'b')[] |
| 408 | +
|
| 409 | +// Merge an array into a tuple |
| 410 | +type TupleArrayMerge = MergeDeep<[1, 2, 3], string[]>; // => (string | 1 | 2 | 3)[] |
| 411 | +
|
| 412 | +// Merge a tuple into an array |
| 413 | +type ArrayTupleMerge = MergeDeep<number[], ['a', 'b']>; // => (number | 'b' | 'a')[] |
| 414 | +``` |
| 415 | +
|
| 416 | +@example |
| 417 | +``` |
| 418 | +import type {MergeDeep, MergeDeepOptions} from 'type-fest'; |
| 419 | +
|
| 420 | +type Foo = {foo: 'foo'; fooBar: string[]}; |
| 421 | +type Bar = {bar: 'bar'; fooBar: number[]}; |
| 422 | +
|
| 423 | +type FooBar = MergeDeep<Foo, Bar>; |
| 424 | +// { foo: "foo"; bar: "bar"; fooBar: number[]} |
| 425 | +
|
| 426 | +type FooBarSpread = MergeDeep<Foo, Bar, {arrayMergeMode: 'spread'}>; |
| 427 | +// { foo: "foo"; bar: "bar"; fooBar: (string | number)[]} |
| 428 | +
|
| 429 | +type FooBarArray = MergeDeep<Foo[], Bar[]>; |
| 430 | +// (Foo | Bar)[] |
| 431 | +
|
| 432 | +type FooBarArrayDeep = MergeDeep<Foo[], Bar[], {recurseIntoArrays: true}>; |
| 433 | +// FooBar[] |
| 434 | +
|
| 435 | +type FooBarArraySpreadDeep = MergeDeep<Foo[], Bar[], {recurseIntoArrays: true; arrayMergeMode: 'spread'}>; |
| 436 | +// FooBarSpread[] |
| 437 | +
|
| 438 | +type FooBarTupleDeep = MergeDeep<[Foo, true, 42], [Bar, 'life'], {recurseIntoArrays: true}>; |
| 439 | +// [FooBar, 'life', 42] |
| 440 | +
|
| 441 | +type FooBarTupleWithArrayDeep = MergeDeep<[Foo[], true], [Bar[], 'life', 42], {recurseIntoArrays: true}>; |
| 442 | +// [FooBar[], 'life', 42] |
| 443 | +``` |
| 444 | +
|
| 445 | +@example |
| 446 | +``` |
| 447 | +import type {MergeDeep, MergeDeepOptions} from 'type-fest'; |
| 448 | +
|
| 449 | +function mergeDeep<Destination, Source, Options extends MergeDeepOptions = {}>( |
| 450 | + destination: Destination, |
| 451 | + source: Source, |
| 452 | + options?: Options, |
| 453 | +): MergeDeep<Destination, Source, Options> { |
| 454 | + // Make your implementation ... |
| 455 | +} |
| 456 | +``` |
| 457 | +
|
| 458 | +@experimental This type is marked as experimental because it depends on {@link ConditionalSimplifyDeep} which itself is experimental. |
| 459 | +
|
| 460 | +@see {@link MergeDeepOptions} |
| 461 | +
|
| 462 | +@category Array |
| 463 | +@category Object |
| 464 | +@category Utilities |
| 465 | +*/ |
| 466 | +export type MergeDeep<Destination, Source, Options extends MergeDeepOptions = {}> = MergeDeepWithDefaultOptions< |
| 467 | +SimplifyDeep<Destination>, |
| 468 | +SimplifyDeep<Source>, |
| 469 | +Options |
| 470 | +>; |
0 commit comments