From f2f5956d653a672073fc3c0174f9d8d6ca9d4371 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 10 May 2024 18:22:43 +1200 Subject: [PATCH] build!: remove typing support for typescript<4.7 --- eslint.config.js | 7 +- package.json | 21 +-- pnpm-lock.yaml | 84 --------- rollup.config.ts | 21 --- tsconfig.base.json | 2 +- types-legacy/v4_0.d.ts | 80 -------- types-legacy/v4_6.d.ts | 407 ----------------------------------------- 7 files changed, 5 insertions(+), 617 deletions(-) delete mode 100644 types-legacy/v4_0.d.ts delete mode 100644 types-legacy/v4_6.d.ts diff --git a/eslint.config.js b/eslint.config.js index f6a1f124..4b642007 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -14,12 +14,7 @@ export default rsEslint( markdown: true, stylistic: true, yaml: true, - ignores: [ - "tests/modules", - "tests/types", - "types-legacy", - "benchmark/data.json", - ], + ignores: ["tests/modules", "tests/types", "benchmark/data.json"], }, { files: ["tests/utils.ts"], diff --git a/package.json b/package.json index b6704cd4..5e259a99 100644 --- a/package.json +++ b/package.json @@ -35,26 +35,12 @@ "type": "module", "exports": { "types": { - "import": "./dist/node/types/current/index.d.mts", - "require": "./dist/node/types/current/index.d.cts" + "import": "./dist/node/index.d.mts", + "require": "./dist/node/index.d.cts" }, "import": "./dist/node/index.mjs", "require": "./dist/node/index.cjs" }, - "main": "dist/node/index.cjs", - "module": "dist/node/index.mjs", - "types": "dist/node/types/legacy/v4_0.d.ts", - "typesVersions": { - "<4.1": { - "*": ["dist/node/types/legacy/v4_0.d.ts"] - }, - "<4.7": { - "*": ["dist/node/types/legacy/v4_6.d.ts"] - }, - ">=4.7": { - "*": ["dist/node/types/current/index.d.mts"] - } - }, "files": [ "dist/node/", "package.json", @@ -89,7 +75,7 @@ "test": "pnpm run test:js && pnpm run test:types", "test:js": "vitest --coverage --run", "test:js:watch": "vitest", - "test:types": "pnpm run build:node && tsd -f 'tests/**/*.test-d.ts'", + "test:types": "pnpm run build:node && tsd -f 'tests/**/*.test-d.ts' -t 'dist/node/index.d.mts'", "type-check": "tsc --noEmit -p tsconfig.build.json" }, "devDependencies": { @@ -148,7 +134,6 @@ "prettier-plugin-packagejson": "2.5.0", "rimraf": "5.0.7", "rollup": "4.17.2", - "rollup-plugin-copy": "3.5.0", "rollup-plugin-ts": "3.4.5", "semantic-release": "23.1.1", "tsc-files": "1.1.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a2ac5a62..e340d061 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -173,9 +173,6 @@ importers: rollup: specifier: 4.17.2 version: 4.17.2 - rollup-plugin-copy: - specifier: 3.5.0 - version: 3.5.0 rollup-plugin-ts: specifier: 3.4.5 version: 3.4.5(rollup@4.17.2)(typescript@5.4.5) @@ -1190,12 +1187,6 @@ packages: '@types/estree@1.0.5': resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} - '@types/fs-extra@8.1.2': - resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} - - '@types/glob@7.2.0': - resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} - '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} @@ -1208,9 +1199,6 @@ packages: '@types/mdast@3.0.10': resolution: {integrity: sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA==} - '@types/minimatch@5.1.2': - resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==} - '@types/minimist@1.2.2': resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} @@ -1644,9 +1632,6 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - colorette@1.4.0: - resolution: {integrity: sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==} - colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} @@ -2392,10 +2377,6 @@ packages: resolution: {integrity: sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==} engines: {node: '>=14.14'} - fs-extra@8.1.0: - resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} - engines: {node: '>=6 <7 || >=8'} - fs-extra@9.1.0: resolution: {integrity: sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==} engines: {node: '>=10'} @@ -2525,10 +2506,6 @@ packages: resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} engines: {node: '>= 0.4'} - globby@10.0.1: - resolution: {integrity: sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==} - engines: {node: '>=8'} - globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} @@ -2837,10 +2814,6 @@ packages: resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} engines: {node: '>=12'} - is-plain-object@3.0.1: - resolution: {integrity: sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==} - engines: {node: '>=0.10.0'} - is-plain-object@5.0.0: resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} engines: {node: '>=0.10.0'} @@ -3007,9 +2980,6 @@ packages: jsonc-parser@3.2.1: resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==} - jsonfile@4.0.0: - resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} - jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} @@ -3869,10 +3839,6 @@ packages: engines: {node: '>=14.18'} hasBin: true - rollup-plugin-copy@3.5.0: - resolution: {integrity: sha512-wI8D5dvYovRMx/YYKtUNt3Yxaw4ORC9xo6Gt9t22kveWz1enG9QrhVlagzwrxSC455xD1dHMKhIJkbsQ7d48BA==} - engines: {node: '>=8.3'} - rollup-plugin-ts@3.4.5: resolution: {integrity: sha512-9iCstRJpEZXSRQuXitlSZAzcGlrqTbJg1pE4CMbEi6xYldxVncdPyzA2I+j6vnh73wBymZckerS+Q/iEE/M3Ow==} engines: {node: '>=16.15.1', npm: '>=7.0.0', pnpm: '>=3.2.0', yarn: '>=1.13'} @@ -4416,10 +4382,6 @@ packages: universal-user-agent@7.0.2: resolution: {integrity: sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==} - universalify@0.1.2: - resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} - engines: {node: '>= 4.0.0'} - universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} engines: {node: '>= 10.0.0'} @@ -5621,15 +5583,6 @@ snapshots: '@types/estree@1.0.5': {} - '@types/fs-extra@8.1.2': - dependencies: - '@types/node': 20.12.12 - - '@types/glob@7.2.0': - dependencies: - '@types/minimatch': 5.1.2 - '@types/node': 20.12.12 - '@types/json-schema@7.0.15': {} '@types/json5@0.0.29': {} @@ -5640,8 +5593,6 @@ snapshots: dependencies: '@types/unist': 2.0.6 - '@types/minimatch@5.1.2': {} - '@types/minimist@1.2.2': {} '@types/node@17.0.45': {} @@ -6118,8 +6069,6 @@ snapshots: color-name@1.1.4: {} - colorette@1.4.0: {} - colorette@2.0.20: {} commander@11.1.0: {} @@ -7128,12 +7077,6 @@ snapshots: jsonfile: 6.1.0 universalify: 2.0.0 - fs-extra@8.1.0: - dependencies: - graceful-fs: 4.2.10 - jsonfile: 4.0.0 - universalify: 0.1.2 - fs-extra@9.1.0: dependencies: at-least-node: 1.0.0 @@ -7272,17 +7215,6 @@ snapshots: dependencies: define-properties: 1.1.4 - globby@10.0.1: - dependencies: - '@types/glob': 7.2.0 - array-union: 2.1.0 - dir-glob: 3.0.1 - fast-glob: 3.3.2 - glob: 7.2.3 - ignore: 5.3.1 - merge2: 1.4.1 - slash: 3.0.0 - globby@11.1.0: dependencies: array-union: 2.1.0 @@ -7570,8 +7502,6 @@ snapshots: is-plain-obj@4.1.0: {} - is-plain-object@3.0.1: {} - is-plain-object@5.0.0: {} is-regex@1.1.4: @@ -7718,10 +7648,6 @@ snapshots: jsonc-parser@3.2.1: {} - jsonfile@4.0.0: - optionalDependencies: - graceful-fs: 4.2.10 - jsonfile@6.1.0: dependencies: universalify: 2.0.0 @@ -8518,14 +8444,6 @@ snapshots: dependencies: glob: 10.3.14 - rollup-plugin-copy@3.5.0: - dependencies: - '@types/fs-extra': 8.1.2 - colorette: 1.4.0 - fs-extra: 8.1.0 - globby: 10.0.1 - is-plain-object: 3.0.1 - rollup-plugin-ts@3.4.5(rollup@4.17.2)(typescript@5.4.5): dependencies: '@rollup/pluginutils': 5.1.0(rollup@4.17.2) @@ -9053,8 +8971,6 @@ snapshots: universal-user-agent@7.0.2: {} - universalify@0.1.2: {} - universalify@2.0.0: {} update-browserslist-db@1.0.15(browserslist@4.23.0): diff --git a/rollup.config.ts b/rollup.config.ts index c5b3900c..1337b1f4 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,17 +1,10 @@ -import { dirname, join, relative } from "node:path"; -import { fileURLToPath } from "node:url"; - import rollupPluginReplace from "@rollup/plugin-replace"; import { rollupPlugin as rollupPluginDeassert } from "deassert"; import { type RollupOptions } from "rollup"; -import rollupPluginCopy from "rollup-plugin-copy"; import rollupPluginTs from "rollup-plugin-ts"; import p from "./package.json" assert { type: "json" }; -const root = dirname(fileURLToPath(import.meta.url)); -const nodeDistPath = join(root, "dist/node"); - const pkg = p as typeof p & { dependencies?: Record; peerDependencies?: Record; @@ -49,15 +42,6 @@ const library = { rollupPluginTs({ transpileOnly: true, tsconfig: "tsconfig.build.json", - hook: { - outputPath: (path, kind) => { - if (kind === "declaration") { - const relativePathToNodeDist = relative(nodeDistPath, path); - return join(nodeDistPath, "types/current", relativePathToNodeDist); - } - return path; - }, - }, }), rollupPluginReplace({ values: { @@ -68,11 +52,6 @@ const library = { rollupPluginDeassert({ include: ["**/*.{js,ts}"], }), - rollupPluginCopy({ - targets: [ - { src: "types-legacy", dest: "dist/node/types", rename: "legacy" }, - ], - }), ], treeshake, diff --git a/tsconfig.base.json b/tsconfig.base.json index e3349c53..8e0ff56d 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -31,5 +31,5 @@ "baseUrl": ".", "paths": {} }, - "exclude": ["benchmark/", "dist/", "types-legacy/"] + "exclude": ["benchmark/", "dist/"] } diff --git a/types-legacy/v4_0.d.ts b/types-legacy/v4_0.d.ts deleted file mode 100644 index 7a30a0a1..00000000 --- a/types-legacy/v4_0.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @file - * - * These types are a more simplified version of this library's types - * designed to work with versions of TypeScript < 4.1 - */ - -declare type MetaDataUpdater = (previousMeta: any, metaMeta: any) => any; - -/** - * All the options the user can pass to customize deepmerge. - */ -declare type DeepMergeOptionsFull = Readonly<{ - mergeRecords: DeepMergeMergeFunctions["mergeRecords"] | false; - mergeArrays: DeepMergeMergeFunctions["mergeArrays"] | false; - mergeMaps: DeepMergeMergeFunctions["mergeMaps"] | false; - mergeSets: DeepMergeMergeFunctions["mergeSets"] | false; - mergeOthers: DeepMergeMergeFunctions["mergeOthers"]; - metaDataUpdater: MetaDataUpdater; -}>; - -/** - * All the merge functions that deepmerge uses. - */ -declare type DeepMergeMergeFunctions = Readonly<{ - mergeRecords: >>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any; - mergeArrays: >, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any; - mergeMaps: >>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any; - mergeSets: >>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any; - mergeOthers: , U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: any) => any; -}>; - -/** - * The utils provided to the merge functions. - */ -declare type DeepMergeMergeFunctionUtils = Readonly<{ - mergeFunctions: DeepMergeMergeFunctions; - defaultMergeFunctions: DeepMergeMergeFunctionsDefaults; - metaDataUpdater: MetaDataUpdater; - deepmerge: >(...values: Ts) => any; -}>; - -/** - * The default merge functions. - */ -declare type DeepMergeMergeFunctionsDefaults = Readonly<{ - mergeMaps: (values: Record[]) => any; - mergeSets: (values: any[][]) => any; - mergeArrays: (values: Set[]) => any; - mergeRecords: (values: Map[], utils: DeepMergeMergeFunctionUtils, meta: any) => any; - mergeOthers: (values: any[]) => any; -}>; - -/** - * Deeply merge objects. - * - * @param objects - The objects to merge. - */ -declare function deepmerge(): undefined; -declare function deepmerge(arg0: T0): T0; -declare function deepmerge(arg0: T0, arg1: T1): T0 & T1; -declare function deepmerge(arg0: T0, arg1: T1, arg2: T2): T0 & T1 & T2; -declare function deepmerge(arg0: T0, arg1: T1, arg2: T2, arg3: T3): T0 & T1 & T2 & T3; -declare function deepmerge(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4): T0 & T1 & T2 & T3 & T4; -declare function deepmerge(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): T0 & T1 & T2 & T3 & T4 & T5; -declare function deepmerge(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6): T0 & T1 & T2 & T3 & T4 & T5 & T6; -declare function deepmerge(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7): T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7; -declare function deepmerge(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8): T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8; -declare function deepmerge(arg0: T0, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9): T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8 & T9; -declare function deepmerge(...args: any[]): any; - -/** - * Deeply merge two or more objects using the given options and meta data. - * - * @param options - The options on how to customize the merge function. - * @param rootMetaData - The meta data passed to the root items' being merged. - */ -declare function deepmergeCustom(options: Partial, rootMetaData?: any): (...objects: any[]) => any; - -export { deepmerge, deepmergeCustom }; diff --git a/types-legacy/v4_6.d.ts b/types-legacy/v4_6.d.ts deleted file mode 100644 index 6738d013..00000000 --- a/types-legacy/v4_6.d.ts +++ /dev/null @@ -1,407 +0,0 @@ -/** - * Flatten a complex type such as a union or intersection of objects into a - * single object. - */ -declare type FlatternAlias = { - [P in keyof T]: T[P]; -} & {}; -/** - * Get the value of the given key in the given object. - */ -declare type ValueOfKey, K extends PropertyKey> = K extends keyof T ? T[K] : never; -/** - * Safely test whether or not the first given types extends the second. - * - * Needed in particular for testing if a type is "never". - */ -declare type Is = [T1] extends [T2] ? true : false; -/** - * Safely test whether or not the given type is "never". - */ -declare type IsNever = Is; -/** - * Returns whether or not the given type a record. - */ -declare type IsRecord = And>, T extends Readonly> ? true : false>; -/** - * Returns whether or not all the given types are records. - */ -declare type EveryIsRecord> = Ts extends readonly [infer Head, ...infer Rest] ? IsRecord extends true ? Rest extends ReadonlyArray ? EveryIsRecord : true : false : true; -/** - * Returns whether or not the given type is an array. - */ -declare type IsArray = And>, T extends ReadonlyArray ? true : false>; -/** - * Returns whether or not all the given types are arrays. - */ -declare type EveryIsArray> = Ts extends readonly [infer T1] ? IsArray : Ts extends readonly [infer Head, ...infer Rest] ? IsArray extends true ? Rest extends readonly [unknown, ...ReadonlyArray] ? EveryIsArray : false : false : false; -/** - * Returns whether or not the given type is an set. - * - * Note: This may also return true for Maps. - */ -declare type IsSet = And>, T extends Readonly> ? true : false>; -/** - * Returns whether or not all the given types are sets. - * - * Note: This may also return true if all are maps. - */ -declare type EveryIsSet> = Ts extends Readonly ? IsSet : Ts extends readonly [infer Head, ...infer Rest] ? IsSet extends true ? Rest extends readonly [unknown, ...ReadonlyArray] ? EveryIsSet : false : false : false; -/** - * Returns whether or not the given type is an map. - */ -declare type IsMap = And>, T extends Readonly> ? true : false>; -/** - * Returns whether or not all the given types are maps. - */ -declare type EveryIsMap> = Ts extends Readonly ? IsMap : Ts extends readonly [infer Head, ...infer Rest] ? IsMap extends true ? Rest extends readonly [unknown, ...ReadonlyArray] ? EveryIsMap : false : false : false; -/** - * And operator for types. - */ -declare type And = T1 extends false ? false : T2; -/** - * Not operator for types. - */ -declare type Not = T extends true ? false : true; -/** - * Union of the sets' values' types - */ -declare type UnionSetValues> = UnionSetValuesHelper; -/** - * Tail-recursive helper type for UnionSetValues. - */ -declare type UnionSetValuesHelper, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly> ? Rest extends ReadonlyArray ? UnionSetValuesHelper : Acc | V1 : never : Acc; -/** - * Union of the maps' values' types - */ -declare type UnionMapKeys> = UnionMapKeysHelper; -/** - * Tail-recursive helper type for UnionMapKeys. - */ -declare type UnionMapKeysHelper, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly> ? Rest extends readonly [] ? Acc | K1 : UnionMapKeysHelper : never : Acc; -/** - * Union of the maps' keys' types - */ -declare type UnionMapValues> = UnionMapValuesHelper; -/** - * Tail-recursive helper type for UnionMapValues. - */ -declare type UnionMapValuesHelper, Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly> ? Rest extends readonly [] ? Acc | V1 : UnionMapValuesHelper : never : Acc; -/** - * Get the keys of the type what match a certain criteria. - */ -declare type KeysOfType = { - [K in keyof T]: T[K] extends U ? K : never; -}[keyof T]; -/** - * Get the required keys of the type. - */ -declare type RequiredKeys = Exclude>, undefined>; -/** - * Get all the required keys on the types in the tuple. - */ -declare type RequiredKeysOf]> = RequiredKeysOfHelper; -/** - * Tail-recursive helper type for RequiredKeysOf. - */ -declare type RequiredKeysOfHelper], Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Record ? Rest extends readonly [unknown, ...ReadonlyArray] ? RequiredKeysOfHelper> : Acc | RequiredKeys : never : Acc; -/** - * Get the optional keys of the type. - */ -declare type OptionalKeys = Exclude>; -/** - * Get all the optional keys on the types in the tuple. - */ -declare type OptionalKeysOf]> = OptionalKeysOfHelper; -/** - * Tail-recursive helper type for OptionalKeysOf. - */ -declare type OptionalKeysOfHelper], Acc> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Record ? Rest extends readonly [unknown, ...ReadonlyArray] ? OptionalKeysOfHelper> : Acc | OptionalKeys : never : Acc; -/** - * Filter out nevers from a tuple. - */ -declare type FilterOutNever> = FilterOutNeverHelper; -/** - * Tail-recursive helper type for FilterOutNever. - */ -declare type FilterOutNeverHelper, Acc extends ReadonlyArray> = T extends readonly [] ? Acc : T extends readonly [infer Head, ...infer Rest] ? IsNever extends true ? FilterOutNeverHelper : FilterOutNeverHelper : T; -/** - * Is the type a tuple? - */ -declare type IsTuple> = T extends readonly [] ? true : T extends readonly [unknown, ...ReadonlyArray] ? true : false; - -/** - * Mapping of merge function URIs to the merge function type. - */ -interface DeepMergeMergeFunctionURItoKind, MF extends DeepMergeMergeFunctionsURIs, M> { - readonly DeepMergeLeafURI: DeepMergeLeaf; - readonly DeepMergeRecordsDefaultURI: DeepMergeRecordsDefaultHKT; - readonly DeepMergeArraysDefaultURI: DeepMergeArraysDefaultHKT; - readonly DeepMergeSetsDefaultURI: DeepMergeSetsDefaultHKT; - readonly DeepMergeMapsDefaultURI: DeepMergeMapsDefaultHKT; -} -/** - * Get the type of the given merge function via its URI. - */ -declare type DeepMergeMergeFunctionKind, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionURItoKind[URI]; -/** - * A union of all valid merge function URIs. - */ -declare type DeepMergeMergeFunctionURIs = keyof DeepMergeMergeFunctionURItoKind, DeepMergeMergeFunctionsURIs, unknown>; -/** - * The merge functions to use when deep merging. - */ -declare type DeepMergeMergeFunctionsURIs = Readonly<{ - /** - * The merge function to merge records with. - */ - DeepMergeRecordsURI: DeepMergeMergeFunctionURIs; - /** - * The merge function to merge arrays with. - */ - DeepMergeArraysURI: DeepMergeMergeFunctionURIs; - /** - * The merge function to merge sets with. - */ - DeepMergeSetsURI: DeepMergeMergeFunctionURIs; - /** - * The merge function to merge maps with. - */ - DeepMergeMapsURI: DeepMergeMergeFunctionURIs; - /** - * The merge function to merge other things with. - */ - DeepMergeOthersURI: DeepMergeMergeFunctionURIs; -}>; -/** - * Deep merge types. - */ -declare type DeepMergeHKT, MF extends DeepMergeMergeFunctionsURIs, M> = IsTuple extends true ? Ts extends readonly [] ? undefined : Ts extends readonly [infer T1] ? T1 : EveryIsArray extends true ? DeepMergeArraysHKT : EveryIsMap extends true ? DeepMergeMapsHKT : EveryIsSet extends true ? DeepMergeSetsHKT : EveryIsRecord extends true ? DeepMergeRecordsHKT : DeepMergeOthersHKT : unknown; -/** - * Deep merge records. - */ -declare type DeepMergeRecordsHKT, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind; -/** - * Deep merge arrays. - */ -declare type DeepMergeArraysHKT, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind; -/** - * Deep merge sets. - */ -declare type DeepMergeSetsHKT, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind; -/** - * Deep merge maps. - */ -declare type DeepMergeMapsHKT, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind; -/** - * Deep merge other things. - */ -declare type DeepMergeOthersHKT, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeMergeFunctionKind; -/** - * The merge function that returns a leaf. - */ -declare type DeepMergeLeafURI = "DeepMergeLeafURI"; -/** - * Get the leaf type from many types that can't be merged. - * - * @deprecated Use `DeepMergeLeaf` instead. - */ -declare type DeepMergeLeafHKT> = DeepMergeLeaf; -/** - * Get the leaf type from many types that can't be merged. - */ -declare type DeepMergeLeaf> = Ts extends readonly [] ? never : Ts extends readonly [infer T] ? T : Ts extends readonly [...infer Rest, infer Tail] ? IsNever extends true ? Rest extends ReadonlyArray ? DeepMergeLeaf : never : Tail : never; -/** - * The meta data deepmerge is able to provide. - */ -declare type DeepMergeBuiltInMetaData = Readonly<{ - key: PropertyKey; - parents: ReadonlyArray>>; -}>; - -/** - * The default merge function to merge records with. - */ -declare type DeepMergeRecordsDefaultURI = "DeepMergeRecordsDefaultURI"; -/** - * The default merge function to merge arrays with. - */ -declare type DeepMergeArraysDefaultURI = "DeepMergeArraysDefaultURI"; -/** - * The default merge function to merge sets with. - */ -declare type DeepMergeSetsDefaultURI = "DeepMergeSetsDefaultURI"; -/** - * The default merge function to merge maps with. - */ -declare type DeepMergeMapsDefaultURI = "DeepMergeMapsDefaultURI"; -/** - * The default merge functions to use when deep merging. - */ -declare type DeepMergeMergeFunctionsDefaultURIs = Readonly<{ - DeepMergeRecordsURI: DeepMergeRecordsDefaultURI; - DeepMergeArraysURI: DeepMergeArraysDefaultURI; - DeepMergeSetsURI: DeepMergeSetsDefaultURI; - DeepMergeMapsURI: DeepMergeMapsDefaultURI; - DeepMergeOthersURI: DeepMergeLeafURI; -}>; -/** - * A union of all the props that should not be included in type information for - * merged records. - */ -declare type BlacklistedRecordProps = "__proto__"; -/** - * Deep merge records. - */ -declare type DeepMergeRecordsDefaultHKT, MF extends DeepMergeMergeFunctionsURIs, M> = Ts extends Readonly>]> ? FlatternAlias, BlacklistedRecordProps>> : {}; -/** - * Deep merge record props. - */ -declare type DeepMergeRecordsDefaultHKTInternalProps], MF extends DeepMergeMergeFunctionsURIs, M> = { - [K in OptionalKeysOf]?: DeepMergeHKT, MF, M>; -} & { - [K in RequiredKeysOf]: DeepMergeHKT, MF, M>; -}; -/** - * Get the value of the property. - */ -declare type DeepMergeRecordsDefaultHKTInternalPropValue], K extends PropertyKey, M> = FilterOutNever>; -/** - * Tail-recursive helper type for DeepMergeRecordsDefaultHKTInternalPropValue. - */ -declare type DeepMergeRecordsDefaultHKTInternalPropValueHelper], K extends PropertyKey, M, Acc extends ReadonlyArray> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends Readonly> ? Rest extends readonly [unknown, ...ReadonlyArray] ? DeepMergeRecordsDefaultHKTInternalPropValueHelper -]> : [...Acc, ValueOfKey] : never : never; -/** - * Deep merge 2 arrays. - */ -declare type DeepMergeArraysDefaultHKT, MF extends DeepMergeMergeFunctionsURIs, M> = DeepMergeArraysDefaultHKTHelper; -/** - * Tail-recursive helper type for DeepMergeArraysDefaultHKT. - */ -declare type DeepMergeArraysDefaultHKTHelper, MF extends DeepMergeMergeFunctionsURIs, M, Acc extends ReadonlyArray> = Ts extends readonly [infer Head, ...infer Rest] ? Head extends ReadonlyArray ? Rest extends readonly [ - ReadonlyArray, - ...ReadonlyArray> -] ? DeepMergeArraysDefaultHKTHelper : [...Acc, ...Head] : never : never; -/** - * Deep merge 2 sets. - */ -declare type DeepMergeSetsDefaultHKT> = Set>; -/** - * Deep merge 2 maps. - */ -declare type DeepMergeMapsDefaultHKT> = Map, UnionMapValues>; -/** - * Get the merge functions with defaults apply from the given subset. - */ -declare type GetDeepMergeMergeFunctionsURIs> = Readonly<{ - DeepMergeRecordsURI: PMF["DeepMergeRecordsURI"] extends keyof DeepMergeMergeFunctionURItoKind ? PMF["DeepMergeRecordsURI"] : DeepMergeRecordsDefaultURI; - DeepMergeArraysURI: PMF["DeepMergeArraysURI"] extends keyof DeepMergeMergeFunctionURItoKind ? PMF["DeepMergeArraysURI"] : DeepMergeArraysDefaultURI; - DeepMergeSetsURI: PMF["DeepMergeSetsURI"] extends keyof DeepMergeMergeFunctionURItoKind ? PMF["DeepMergeSetsURI"] : DeepMergeSetsDefaultURI; - DeepMergeMapsURI: PMF["DeepMergeMapsURI"] extends keyof DeepMergeMergeFunctionURItoKind ? PMF["DeepMergeMapsURI"] : DeepMergeMapsDefaultURI; - DeepMergeOthersURI: PMF["DeepMergeOthersURI"] extends keyof DeepMergeMergeFunctionURItoKind ? PMF["DeepMergeOthersURI"] : DeepMergeLeafURI; -}>; - -/** - * The options the user can pass to customize deepmerge. - */ -declare type DeepMergeOptions> = DeepMergeBuiltInMetaData> = Partial>; -declare type MetaDataUpdater = (previousMeta: M | undefined, metaMeta: Readonly>) => M; -/** - * All the options the user can pass to customize deepmerge. - */ -declare type DeepMergeOptionsFull = Readonly<{ - mergeRecords: DeepMergeMergeFunctions["mergeRecords"] | false; - mergeArrays: DeepMergeMergeFunctions["mergeArrays"] | false; - mergeMaps: DeepMergeMergeFunctions["mergeMaps"] | false; - mergeSets: DeepMergeMergeFunctions["mergeSets"] | false; - mergeOthers: DeepMergeMergeFunctions["mergeOthers"]; - metaDataUpdater: MetaDataUpdater; - enableImplicitDefaultMerging: boolean; -}>; -/** - * All the merge functions that deepmerge uses. - */ -declare type DeepMergeMergeFunctions = Readonly<{ - mergeRecords: >>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: M | undefined) => unknown; - mergeArrays: >, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: M | undefined) => unknown; - mergeMaps: >>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: M | undefined) => unknown; - mergeSets: >>, U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: M | undefined) => unknown; - mergeOthers: , U extends DeepMergeMergeFunctionUtils>(records: Ts, utils: U, meta: M | undefined) => unknown; -}>; -/** - * The utils provided to the merge functions. - */ -declare type DeepMergeMergeFunctionUtils = Readonly<{ - mergeFunctions: DeepMergeMergeFunctions; - defaultMergeFunctions: DeepMergeMergeFunctionsDefaults; - metaDataUpdater: MetaDataUpdater; - deepmerge: >(...values: Ts) => unknown; - useImplicitDefaultMerging: boolean; - actions: Readonly<{ - defaultMerge: symbol; - skip: symbol; - }>; -}>; - -declare const defaultMergeFunctions: { - readonly mergeMaps: typeof defaultMergeMaps; - readonly mergeSets: typeof defaultMergeSets; - readonly mergeArrays: typeof defaultMergeArrays; - readonly mergeRecords: typeof defaultMergeRecords; - readonly mergeOthers: typeof leaf; -}; -/** - * The default merge functions. - */ -declare type DeepMergeMergeFunctionsDefaults = typeof defaultMergeFunctions; -/** - * Deeply merge objects. - * - * @param objects - The objects to merge. - */ -declare function deepmerge>>(...objects: readonly [...Ts]): DeepMergeHKT; -/** - * Deeply merge two or more objects using the given options. - * - * @param options - The options on how to customize the merge function. - */ -declare function deepmergeCustom>(options: DeepMergeOptions): >(...objects: Ts) => DeepMergeHKT, DeepMergeBuiltInMetaData>; -/** - * Deeply merge two or more objects using the given options and meta data. - * - * @param options - The options on how to customize the merge function. - * @param rootMetaData - The meta data passed to the root items' being merged. - */ -declare function deepmergeCustom, MetaData, MetaMetaData extends DeepMergeBuiltInMetaData = DeepMergeBuiltInMetaData>(options: DeepMergeOptions, rootMetaData?: MetaData): >(...objects: Ts) => DeepMergeHKT, MetaData>; -/** - * The default strategy to merge records. - * - * @param values - The records. - */ -declare function defaultMergeRecords>, U extends DeepMergeMergeFunctionUtils, MF extends DeepMergeMergeFunctionsURIs, M, MM extends DeepMergeBuiltInMetaData>(values: Ts, utils: U, meta: M | undefined): DeepMergeRecordsDefaultHKT; -/** - * The default strategy to merge arrays. - * - * @param values - The arrays. - */ -declare function defaultMergeArrays>, MF extends DeepMergeMergeFunctionsURIs, M>(values: Ts): DeepMergeArraysDefaultHKT; -/** - * The default strategy to merge sets. - * - * @param values - The sets. - */ -declare function defaultMergeSets>>>(values: Ts): DeepMergeSetsDefaultHKT; -/** - * The default strategy to merge maps. - * - * @param values - The maps. - */ -declare function defaultMergeMaps>>>(values: Ts): DeepMergeMapsDefaultHKT; -/** - * Get the last value in the given array. - */ -declare function leaf>(values: Ts): unknown; - -export { DeepMergeArraysDefaultHKT, DeepMergeBuiltInMetaData, DeepMergeHKT, DeepMergeLeaf, DeepMergeLeafHKT, DeepMergeLeafURI, DeepMergeMapsDefaultHKT, DeepMergeMergeFunctionURItoKind, DeepMergeMergeFunctionUtils, DeepMergeMergeFunctionsDefaultURIs, DeepMergeMergeFunctionsDefaults, DeepMergeMergeFunctionsURIs, DeepMergeOptions, DeepMergeRecordsDefaultHKT, DeepMergeSetsDefaultHKT, deepmerge, deepmergeCustom };