/** * Makes T a union of T, null, and undefined */ export declare type Nullable = T | null | undefined; /** * Makes all properties of T mutable */ export declare type Mutable = { -readonly [P in keyof T]: T[P]; }; /** * Picks the element type of the given iterable. * For example, for the given array literal type: ["foo", "bar", "baz"], * the type is "foo"|"bar"|"baz" */ export declare type ElementOf = Iterable extends (infer ArrayElementType)[] ? ArrayElementType : Iterable extends readonly (infer ReadonlyArrayElementType)[] ? ReadonlyArrayElementType : Iterable extends Set ? SetElementType : Iterable extends string ? Iterable : never; /** * Something that is an array of T's or a single T */ export declare type MaybeArray = T[] | T; /** * Ensures that T is an array of the element type of T */ export declare type EnsureArray = T extends (infer U)[] ? U[] : T[]; /** * A variant of Required where not only the keys are required, but also the values */ export declare type RequiredValues = { [P in keyof T]-?: Exclude; }; /** * Picks only keys for which there is an optional modifier */ export declare type PickOptional = Pick ? never : K; }[keyof T], undefined>>; /** * Picks only keys for which there is no optional modifier */ export declare type PickRequired = Pick ? K : never; }[keyof T], undefined>>; /** * Picks those keys from A that intersects with those from B */ export declare type PickIntersectingKeys = Pick>; /** * Picks from T the properties for which their type matches Type */ export declare type PickMembersOfType = Pick; export declare type PickMembersOfNotOfType = Pick; /** * Builds up a lookup path into a record via tuple elements. For example, for the record `{ a: {b: {c: string}}}`, a valid value could be `["a", "b", "c"]` * It takes as the second optional type argument the maximum depth it can recursively descent into the target object (default: 10). * When an Array is discovered, indexes into the array can be provided. For example, for the record `{a: {foo: string}[]}`, a value like `["a", 0, "foo"]` is allowed. */ export declare type ObjectLookupTuple = ObjectLookupTupleHelper; declare type ObjectLookupTupleHelper = { [Key in keyof T]: CurrentDepth extends MaxDepth ? [...Acc, Key] : T[Key] extends IgnoredLookupValue ? [...Acc, Key] : T[Key] extends (infer El)[] | readonly (infer El)[] ? [...Acc, Key] | ObjectLookupTupleHelper> : [...Acc, Key] | ObjectLookupTupleHelper, [...Acc, Key, number], MaxDepth, Next>; }[keyof T]; /** * A variant of ObjectLookupTuple that will walk into arrays and allow looking up members of their records as part of the lookup path. For * example, for the record `{a: {foo: string}[]}`, a value like `["a", "foo"]` is allowed, even though 'foo' is part of a record within an array */ export declare type ArrayPiercingObjectLookupTuple = ArrayPiercingObjectLookupTupleHelper; declare type ArrayPiercingObjectLookupTupleHelper = { [Key in keyof T]: CurrentDepth extends MaxDepth ? [...Acc, Key] : T[Key] extends IgnoredLookupValue ? [...Acc, Key] : T[Key] extends (infer El)[] | readonly (infer El)[] ? [...Acc, Key] | ArrayPiercingObjectLookupTupleHelper> : [...Acc, Key] | ArrayPiercingObjectLookupTupleHelper, [...Acc, Key], MaxDepth, Next>; }[keyof T]; /** * Behaves similar to ObjectLookupTuple, but builds up strings that dot into objects. For example, for the record `{ a: {b: {c: string}}}`, a valid value could be `a.b.c` */ export declare type ObjectLookupString = ObjectLookupStringHelper; declare type MaybeSuffixWithDot = T extends `` ? T : `${T}.`; declare type ObjectLookupStringHelper = { [Key in keyof T]: Key extends string ? CurrentDepth extends MaxDepth ? `${MaybeSuffixWithDot}${Key}` : T[Key] extends IgnoredLookupValue ? `${MaybeSuffixWithDot}${Key}` : T[Key] extends (infer El)[] | readonly (infer El)[] ? StopAtArrays extends true ? `${MaybeSuffixWithDot}${Key}` : `${MaybeSuffixWithDot}${Key}.${number}` | El extends IgnoredLookupValue ? `${MaybeSuffixWithDot}${Key}.${number}` : ObjectLookupStringHelper}${Key}.${number}`, MaxDepth, Next, StopAtArrays> : `${MaybeSuffixWithDot}${Key}` | ObjectLookupStringHelper, `${MaybeSuffixWithDot}${Key}`, MaxDepth, Next, StopAtArrays> : never; }[keyof T]; /** * A variant of Partial that is deep. * This means that every value is a partial recursively * while still preserving primitive or built-in types as they are */ export declare type PartialDeep = CurrentDepth extends MaxDepth ? T : T extends IgnoredLookupValue ? T : T extends (infer ArrayElement)[] ? PartialDeep>[] : T extends readonly (infer ReadonlyArrayElement)[] ? readonly PartialDeep>[] : T extends Iterable ? Iterable>> : { [P in keyof T]?: PartialDeep>; }; /** * A variant of Required that is deep. * This means that every key is required recursively * while still preserving primitive or built-in types as they are */ export declare type RequiredDeep = CurrentDepth extends MaxDepth ? T : T extends IgnoredLookupValue ? T : T extends (infer ArrayElement)[] ? RequiredDeep>[] : T extends readonly (infer ReadonlyArrayElement)[] ? readonly RequiredDeep>[] : T extends Iterable ? Iterable>> : { [P in keyof T]-?: RequiredDeep>; }; /** * A partial of T except for the keys given in K */ export declare type PartialExcept = Omit, K> & Pick; /** * A partial of T except for the keys given in K */ export declare type PartialDeepExcept = Omit, K> & Pick; /** * Require all keys in T, except for the keys given in K */ export declare type RequiredExcept = Omit, K> & Pick; /** * Splits a record into all of its possible property intersections. * For example, for the record {a: 1; b: 2>}, splitting the record will * get the type {a: 1} | {b: 2} back. */ export declare type SplitRecord = Exclude<{ [Key in keyof T]: { [K in Key]: K extends keyof U ? T[K] : never; }; }[keyof T], undefined>; /** * A variant of `SplitRecord` that includes all similar keys. * See the documentation for `SimilarObjectKeys` for more details. */ export declare type SplitRecordWithSimilarKeys = Exclude<{ [Key in keyof T]: Key extends keyof U ? SimilarObjectKeys : never; }[keyof T], undefined>; /** * Selects only the properties from an object for which the keys include the substring(s) given in U. * For example, for the object {foo: 1, fooBar: 2, barFoo: 3, baz: 4}, a value of "foo" for U will return an object with only the keys "foo", "fooBar", and "barFoo" */ export declare type SimilarObjectKeys = PickMembersOfNotOfType<{ [TKey in keyof T]: TKey extends U ? T[TKey] : TKey extends `${infer _Prefix}${Capitalize}` ? T[TKey] | undefined : TKey extends `${infer _Prefix}${U}` ? T[TKey] | undefined : TKey extends `${U}${infer _Suffix}` ? T[TKey] | undefined : never; }, never>; /** * An arbitrary Function that takes any amount of arguments and returns anything */ export declare type ArbitraryFunction = (...args: never[]) => ReturnType; export declare type ArbitraryConstructor = new (...args: never[]) => T; /** * Gets the length of T */ export declare type GetLength = T extends { length: infer L; } ? L : never; /** * Gets the first element of T */ export declare type GetFirst = T[0]; /** * Gets the last element of T */ export declare type GetLast = T[Prev>]; /** * Gets the Nth parameter of the given function */ export declare type NthParameter = Parameters[Parameter]; /** * Gets the first parameter of the given function */ export declare type FirstParameter = GetFirst>; /** * Gets the last parameter of the given function */ export declare type LastParameter = GetLast>; export declare type UncapitalizeKeys = { [Key in keyof T as Uncapitalize]: T[Key]; }; export declare type CapitalizeKeys = { [Key in keyof T as Capitalize]: T[Key]; }; export declare type LowercaseKeys = { [Key in keyof T as Lowercase]: T[Key]; }; export declare type UppercaseKeys = { [Key in keyof T as Uppercase]: T[Key]; }; export declare type PrefixObjectKeys = { [Key in keyof T as SuffixKey]: T[Key]; }; export declare type SuffixObjectKeys = { [Key in keyof T as PrefixKey]: T[Key]; }; export declare type PrefixKey = `${Prefix}${EnsureCamelCase extends true ? Capitalize : T}`; export declare type SuffixKey = `${T}${EnsureCamelCase extends true ? Capitalize : Suffix}`; export declare type Prev = [ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 ][T]; export declare type Next = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101 ][T]; /** * A type indicating something that shouldn't be traversed into when mapping over objects, lists, or other similar data structures */ export declare type IgnoredLookupValue = string | number | bigint | symbol | boolean | undefined | null | Date | RegExp | CallableFunction | Set | WeakSet | Map | WeakMap; export {}; //# sourceMappingURL=index.d.ts.map