@layerzerolabs/typescript-utils 0.2.89 → 0.2.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/dist/24WEKBY3.cjs +0 -44
- package/dist/24WEKBY3.cjs.map +0 -1
- package/dist/2MZ52QXI.cjs +0 -8
- package/dist/2MZ52QXI.cjs.map +0 -1
- package/dist/2OSBYVBM.cjs +0 -8
- package/dist/2OSBYVBM.cjs.map +0 -1
- package/dist/2SJJDCZI.cjs +0 -8
- package/dist/2SJJDCZI.cjs.map +0 -1
- package/dist/4W25K7RR.cjs +0 -8
- package/dist/4W25K7RR.cjs.map +0 -1
- package/dist/53OHF4EH.cjs +0 -8
- package/dist/53OHF4EH.cjs.map +0 -1
- package/dist/574X5FJM.cjs +0 -8
- package/dist/574X5FJM.cjs.map +0 -1
- package/dist/7RPBI4LQ.cjs +0 -8
- package/dist/7RPBI4LQ.cjs.map +0 -1
- package/dist/AKBGASRF.cjs +0 -8
- package/dist/AKBGASRF.cjs.map +0 -1
- package/dist/B4TXK443.cjs +0 -8
- package/dist/B4TXK443.cjs.map +0 -1
- package/dist/C7GMKBCN.cjs +0 -8
- package/dist/C7GMKBCN.cjs.map +0 -1
- package/dist/EUBM3LSR.cjs +0 -1347
- package/dist/EUBM3LSR.cjs.map +0 -1
- package/dist/K3FZ3EZT.cjs +0 -8
- package/dist/K3FZ3EZT.cjs.map +0 -1
- package/dist/KQUDWU4T.cjs +0 -8
- package/dist/KQUDWU4T.cjs.map +0 -1
- package/dist/MLSONTXK.cjs +0 -8
- package/dist/MLSONTXK.cjs.map +0 -1
- package/dist/NKWLAYNJ.cjs +0 -8
- package/dist/NKWLAYNJ.cjs.map +0 -1
- package/dist/Q35ZNXMT.cjs +0 -8
- package/dist/Q35ZNXMT.cjs.map +0 -1
- package/dist/QXEVXGNQ.cjs +0 -8511
- package/dist/QXEVXGNQ.cjs.map +0 -1
- package/dist/TVCGTTL5.cjs +0 -8
- package/dist/TVCGTTL5.cjs.map +0 -1
- package/dist/WPET3HPL.cjs +0 -8
- package/dist/WPET3HPL.cjs.map +0 -1
- package/dist/advancedRecord.cjs +0 -7
- package/dist/advancedRecord.cjs.map +0 -1
- package/dist/asyncify.cjs +0 -7
- package/dist/asyncify.cjs.map +0 -1
- package/dist/branded.cjs +0 -7
- package/dist/branded.cjs.map +0 -1
- package/dist/constructor.cjs +0 -7
- package/dist/constructor.cjs.map +0 -1
- package/dist/deep.cjs +0 -7
- package/dist/deep.cjs.map +0 -1
- package/dist/deep.test-d.cjs +0 -15
- package/dist/deep.test-d.cjs.map +0 -1
- package/dist/disallowedAny.cjs +0 -7
- package/dist/disallowedAny.cjs.map +0 -1
- package/dist/identity.cjs +0 -7
- package/dist/identity.cjs.map +0 -1
- package/dist/index.cjs +0 -25
- package/dist/index.cjs.map +0 -1
- package/dist/lastOf.cjs +0 -7
- package/dist/lastOf.cjs.map +0 -1
- package/dist/maybeUndefined.cjs +0 -7
- package/dist/maybeUndefined.cjs.map +0 -1
- package/dist/merge.cjs +0 -7
- package/dist/merge.cjs.map +0 -1
- package/dist/methodOf.cjs +0 -7
- package/dist/methodOf.cjs.map +0 -1
- package/dist/removeNever.cjs +0 -7
- package/dist/removeNever.cjs.map +0 -1
- package/dist/strings.cjs +0 -7
- package/dist/strings.cjs.map +0 -1
- package/dist/strings.test-d.cjs +0 -21
- package/dist/strings.test-d.cjs.map +0 -1
- package/dist/tuples.cjs +0 -7
- package/dist/tuples.cjs.map +0 -1
- package/dist/valueOf.cjs +0 -7
- package/dist/valueOf.cjs.map +0 -1
- package/dist/viem.cjs +0 -7
- package/dist/viem.cjs.map +0 -1
- package/dist/withRequired.cjs +0 -7
- package/dist/withRequired.cjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/typescript-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.91",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"require": "./dist/index.cjs",
|
|
10
9
|
"import": "./dist/index.js",
|
|
11
|
-
"default": "./dist/index.
|
|
10
|
+
"default": "./dist/index.js"
|
|
12
11
|
},
|
|
13
|
-
"main": "./dist/index.
|
|
12
|
+
"main": "./dist/index.js",
|
|
14
13
|
"module": "./dist/index.js",
|
|
15
14
|
"types": "./dist/index.d.ts",
|
|
16
15
|
"files": [
|
|
@@ -19,8 +18,8 @@
|
|
|
19
18
|
"devDependencies": {
|
|
20
19
|
"tsup": "^8.4.0",
|
|
21
20
|
"vitest": "^3.2.3",
|
|
22
|
-
"@layerzerolabs/tsup-configuration": "0.2.
|
|
23
|
-
"@layerzerolabs/typescript-configuration": "0.2.
|
|
21
|
+
"@layerzerolabs/tsup-configuration": "0.2.91",
|
|
22
|
+
"@layerzerolabs/typescript-configuration": "0.2.91"
|
|
24
23
|
},
|
|
25
24
|
"publishConfig": {
|
|
26
25
|
"access": "public",
|
|
@@ -29,6 +28,7 @@
|
|
|
29
28
|
"externalRepoConfig": {
|
|
30
29
|
"targets": [
|
|
31
30
|
"audit-external",
|
|
31
|
+
"console-pen-test",
|
|
32
32
|
"monorepo-external",
|
|
33
33
|
"onesig-client"
|
|
34
34
|
]
|
package/dist/24WEKBY3.cjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
-
var __esm = (fn, res) => function __init() {
|
|
11
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
|
-
};
|
|
13
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
14
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
-
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
-
for (let key of __getOwnPropNames(from))
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
-
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
-
mod
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
|
|
34
|
-
var init_cjs_shims = __esm({
|
|
35
|
-
"../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"() {
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
exports.__commonJS = __commonJS;
|
|
40
|
-
exports.__name = __name;
|
|
41
|
-
exports.__toESM = __toESM;
|
|
42
|
-
exports.init_cjs_shims = init_cjs_shims;
|
|
43
|
-
//# sourceMappingURL=24WEKBY3.cjs.map
|
|
44
|
-
//# sourceMappingURL=24WEKBY3.cjs.map
|
package/dist/24WEKBY3.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,cAAA,GAAA,KAAA,CAAA","file":"24WEKBY3.cjs","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}
|
package/dist/2MZ52QXI.cjs
DELETED
package/dist/2MZ52QXI.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/valueOf.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAMAA,4BAAA,EAAA","file":"2MZ52QXI.cjs","sourcesContent":["export type IntersectionValueOf<T> = (\n T[keyof T] extends infer U ? (U extends any ? (x: U) => void : never) : never\n) extends (x: infer I) => void\n ? I\n : never;\n\n/**\n * @description Creates a type that extracts the values of T.\n *\n * @example\n * ValueOf<{ a: string, b: number }>\n * => string | number\n *\n * @internal\n */\nexport type ValueOf<T> = T[keyof T];\n"]}
|
package/dist/2OSBYVBM.cjs
DELETED
package/dist/2OSBYVBM.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lastOf.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAcAA,4BAAA,EAAA","file":"2OSBYVBM.cjs","sourcesContent":["export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\nexport type LastOf<T> =\n UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;\n\ntype Prepend<T, U extends any[]> = [T, ...U];\n\nexport type UnionToArray<T, U extends any[] = []> =\n LastOf<T> extends never ? U : UnionToArray<Exclude<T, LastOf<T>>, Prepend<LastOf<T>, U>>;\n\nexport type RestOf<T> = Exclude<T, LastOf<T>>;\n"]}
|
package/dist/2SJJDCZI.cjs
DELETED
package/dist/2SJJDCZI.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/branded.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAAAA,4BAAA,EAAA","file":"2SJJDCZI.cjs","sourcesContent":["const tag = '___tag___';\n/**\n * Creates a branded type of {@link T} with the brand {@link U}.\n *\n * @param T - Type to brand\n * @param U - Label\n * @returns Branded type\n *\n * @example\n * type Result = Branded<string, 'foo'>\n * // ^? type Result = string & { [symbol]: 'foo' }\n */\nexport type Branded<T, U> = T & { [tag]: U };\n/**\n * Represents a percentage as a decimal value. For example, 25% is represented as 0.25\n */\nexport type Percent = number; // Branded<number, 'percent'>\n\nexport type BrandedError<T extends string> = Branded<Error, T>;\n"]}
|
package/dist/4W25K7RR.cjs
DELETED
package/dist/4W25K7RR.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/withRequired.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAEAA,4BAAA,EAAA","file":"4W25K7RR.cjs","sourcesContent":["export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\nexport type AllRequired<T> = {\n [K in keyof T]-?: T[K];\n};\n"]}
|
package/dist/53OHF4EH.cjs
DELETED
package/dist/53OHF4EH.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constructor.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAAAA,4BAAA,EAAA","file":"53OHF4EH.cjs","sourcesContent":["export type Constructor<T> = { new (...args: any[]): T };\n"]}
|
package/dist/574X5FJM.cjs
DELETED
package/dist/574X5FJM.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/disallowedAny.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAIAA,4BAAA,EAAA","file":"574X5FJM.cjs","sourcesContent":["type IsAnyInner<T> = T extends never ? true : false;\n\nexport type IsAny<T> =\n IsAnyInner<T> extends true ? false : IsAnyInner<T> extends false ? false : true;\nexport type DisallowedAny<T> = IsAny<T> extends true ? never : T;\n"]}
|
package/dist/7RPBI4LQ.cjs
DELETED
package/dist/7RPBI4LQ.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/maybeUndefined.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAAAA,4BAAA,EAAA","file":"7RPBI4LQ.cjs","sourcesContent":["/**\n * @description Maps the result type `R` to `R | undefined` when the input type `T` includes `undefined`,\n * preserving the undefined-ness of the input in the output type.\n *\n * @example\n * MaybeUndefinedMapped<string | undefined, number>\n * => number | undefined\n *\n * MaybeUndefinedMapped<string, number>\n * => number\n */\nexport type MaybeUndefinedMapped<T, R> = undefined extends T\n ? T extends undefined\n ? undefined\n : R | undefined\n : R;\n"]}
|
package/dist/AKBGASRF.cjs
DELETED
package/dist/AKBGASRF.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/merge.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAEAA,4BAAA,EAAA","file":"AKBGASRF.cjs","sourcesContent":["import type { Prettify } from './viem';\n\nexport type Merge<T, U> = {} extends T\n ? U\n : {} extends U\n ? T\n : Prettify<\n {\n [key in keyof T]: key extends keyof U ? U[key] : T[key];\n } & {\n [key in keyof U]: U[key];\n }\n >;\n"]}
|
package/dist/B4TXK443.cjs
DELETED
package/dist/B4TXK443.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/viem.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAAAA,4BAAA,EAAA","file":"B4TXK443.cjs","sourcesContent":["/**\n * Filters out all members of {@link T} that are not {@link P}\n *\n * @param T - Items to filter\n * @param P - Type to filter out\n * @returns Filtered items\n *\n * @example\n * type Result = Filter<['a', 'b', 'c'], 'b'>\n * // ^? type Result = ['a', 'c']\n */\nexport type Filter<\n T extends readonly unknown[],\n P,\n Acc extends readonly unknown[] = [],\n> = T extends readonly [infer F, ...infer Rest extends readonly unknown[]]\n ? [F] extends [P]\n ? Filter<Rest, P, [...Acc, F]>\n : Filter<Rest, P, Acc>\n : readonly [...Acc];\n\n/**\n * @description Checks if {@link T} can be narrowed further than {@link U}\n * @param T - Type to check\n * @param U - Type to compare against\n * @example\n * type Result = IsNarrowable<'foo', string>\n * // ^? true\n */\nexport type IsNarrowable<T, U> =\n IsNever<(T extends U ? true : false) & (U extends T ? false : true)> extends true\n ? false\n : true;\n\n/**\n * @description Checks if {@link T} is `never`\n * @param T - Type to check\n * @example\n * type Result = IsNever<never>\n * // ^? type Result = true\n */\nexport type IsNever<T> = [T] extends [never] ? true : false;\n\n/** Removes `readonly` from all properties of an object. */\nexport type Mutable<type extends object> = {\n -readonly [key in keyof type]: type[key];\n};\n\n/**\n * @description Evaluates boolean \"or\" condition for {@link T} properties.\n * @param T - Type to check\n *\n * * @example\n * type Result = Or<[false, true, false]>\n * // ^? type Result = true\n *\n * @example\n * type Result = Or<[false, false, false]>\n * // ^? type Result = false\n */\nexport type Or<T extends readonly unknown[]> = T extends readonly [infer Head, ...infer Tail]\n ? Head extends true\n ? true\n : Or<Tail>\n : false;\n\n/**\n * @description Checks if {@link T} is `undefined`\n * @param T - Type to check\n * @example\n * type Result = IsUndefined<undefined>\n * // ^? type Result = true\n */\nexport type IsUndefined<T> = [undefined] extends [T] ? true : false;\n\nexport type MaybePromise<T> = T | Promise<T>;\n\n/**\n * @description Makes attributes on the type T required if required is true.\n *\n * @example\n * MaybeRequired<{ a: string, b?: number }, true>\n * => { a: string, b: number }\n *\n * MaybeRequired<{ a: string, b?: number }, false>\n * => { a: string, b?: number }\n */\nexport type MaybeRequired<T, required extends boolean> = required extends true\n ? ExactRequired<T>\n : T;\n\n/**\n * @description Assigns the properties of U onto T.\n *\n * @example\n * Assign<{ a: string, b: number }, { a: undefined, c: boolean }>\n * => { a: undefined, b: number, c: boolean }\n */\nexport type Assign<T, U> = Assign_<T, U> & U;\ntype Assign_<T, U> = {\n [K in keyof T as K extends keyof U ? (U[K] extends void ? never : K) : K]: K extends keyof U\n ? U[K]\n : T[K];\n};\n\n// TODO: Remove when peer dep `typescript@>=4.5` (NoInfer is native)\nexport type NoInfer<type> = [type][type extends any ? 0 : never];\n\n/**\n * @description Constructs a type by excluding `undefined` from `T`.\n *\n * @example\n * NoUndefined<string | undefined>\n * => string\n *\n * @internal\n */\nexport type NoUndefined<T> = T extends undefined ? never : T;\n\n/** Strict version of built-in Omit type */\nexport type Omit<type, keys extends keyof type> = Pick<type, Exclude<keyof type, keys>>;\n\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number }, 'a'>\n * => { a?: string, b: number }\n */\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & ExactPartial<Pick<T, K>>;\n\n/**\n * @description Combines members of an intersection into a readable type.\n *\n * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}\n * @example\n * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>\n * => { a: string, b: string, c: number, d: bigint }\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n\n/** @internal */\nexport type Evaluate<type> = {\n [key in keyof type]: type[key];\n} & {};\n\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number }, 'a'>\n * => { a: string, b: number }\n */\nexport type RequiredBy<T, K extends keyof T> = Omit<T, K> & ExactRequired<Pick<T, K>>;\n\n/**\n * @description Returns truthy if `array` contains `value`.\n *\n * @example\n * Some<[1, 2, 3], 2>\n * => true\n */\nexport type Some<array extends readonly unknown[], value> = array extends readonly [\n value,\n ...unknown[],\n]\n ? true\n : array extends readonly [unknown, ...infer rest]\n ? Some<rest, value>\n : false;\n\nexport type UnionToTuple<\n union,\n ///\n last = LastInUnion<union>,\n> = [union] extends [never] ? [] : [...UnionToTuple<Exclude<union, last>>, last];\ntype LastInUnion<U> =\n UnionToIntersection<U extends unknown ? (x: U) => 0 : never> extends (x: infer l) => 0\n ? l\n : never;\ntype UnionToIntersection<union> = (union extends unknown ? (arg: union) => 0 : never) extends (\n arg: infer i,\n) => 0\n ? i\n : never;\n\nexport type IsUnion<\n union,\n ///\n union2 = union,\n> = union extends union2 ? ([union2] extends [union] ? false : true) : never;\n\nexport type MaybePartial<type, enabled extends boolean | undefined> = enabled extends true\n ? Prettify<ExactPartial<type>>\n : type;\n\nexport type ExactPartial<type> = {\n [key in keyof type]?: type[key] | undefined;\n};\n\nexport type ExactRequired<type> = {\n [P in keyof type]-?: Exclude<type[P], undefined>;\n};\n\nexport type OneOf<\n union extends object,\n fallback extends object | undefined = undefined,\n ///\n keys extends KeyofUnion<union> = KeyofUnion<union>,\n> = union extends infer item\n ? Prettify<\n item & {\n [key in Exclude<keys, keyof item>]?: fallback extends object\n ? key extends keyof fallback\n ? fallback[key]\n : undefined\n : undefined;\n }\n >\n : never;\ntype KeyofUnion<type> = type extends type ? keyof type : never;\n\n///////////////////////////////////////////////////////////////////////////\n// Loose types\n\n/**\n * Loose version of {@link Omit}\n * @internal\n */\nexport type LooseOmit<type, keys extends string> = Pick<type, Exclude<keyof type, keys>>;\n\n///////////////////////////////////////////////////////////////////////////\n// Union types\n\nexport type UnionEvaluate<type> = type extends object ? Prettify<type> : type;\n\nexport type UnionLooseOmit<type, keys extends string> = type extends any\n ? LooseOmit<type, keys>\n : never;\n\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionOmit<type, keys extends keyof type> = type extends any ? Omit<type, keys> : never;\n\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionPick<type, keys extends keyof type> = type extends any ? Pick<type, keys> : never;\n\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { a?: string, b: number } | { a?: string, b: undefined, c: number }\n */\nexport type UnionPartialBy<T, K extends keyof T> = T extends any ? PartialBy<T, K> : never;\n\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number } | { a?: string, c?: number }, 'a'>\n * => { a: string, b: number } | { a: string, c?: number }\n */\nexport type UnionRequiredBy<T, K extends keyof T> = T extends any ? RequiredBy<T, K> : never;\n"]}
|
package/dist/C7GMKBCN.cjs
DELETED
package/dist/C7GMKBCN.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/advancedRecord.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAMAA,4BAAA,EAAA","file":"C7GMKBCN.cjs","sourcesContent":["export type AdvancedRecord<T = any, U = any> = {\n readonly [key: string]: readonly [T, U];\n};\n\nexport type DeepWritable<T> = { -readonly [P in keyof T]: DeepWritable<T[P]> };\n\nexport type AdvancedRecordLookup<\n AR extends AdvancedRecord | undefined,\n KeyToFind,\n> = AR extends AdvancedRecord\n ? {\n [P in keyof AR]: AR[P] extends readonly [infer K, infer V]\n ? // Distribute on K\n K extends unknown\n ? KeyToFind extends DeepWritable<K>\n ? V\n : DeepWritable<K> extends KeyToFind\n ? V\n : never\n : never\n : never;\n }[keyof AR]\n : never;\n"]}
|