@empathyco/x-utils
Advanced tools
Comparing version 1.0.0-alpha.14 to 1.0.0-alpha.15
{ | ||
"name": "@empathyco/x-utils", | ||
"version": "1.0.0-alpha.14", | ||
"version": "1.0.0-alpha.15", | ||
"description": "A utility package for Empathy search", | ||
@@ -35,3 +35,3 @@ "author": "Empathy Systems Corporation S.L.", | ||
"dependencies": { | ||
"@empathyco/x-storage-service": "^2.0.0-alpha.6", | ||
"@empathyco/x-storage-service": "^2.0.0-alpha.7", | ||
"nanoid": "~3.1.31", | ||
@@ -45,3 +45,3 @@ "tslib": "~2.4.1" | ||
"ts-jest": "~27.0.7", | ||
"typescript": "~4.6.2" | ||
"typescript": "~4.9.4" | ||
}, | ||
@@ -51,3 +51,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "15b244f7912ba181a563b94307a88998a130ebb9" | ||
"gitHead": "6fccb9c182fa3bad626901b551006a39a7f47d98" | ||
} |
@@ -105,3 +105,3 @@ import { Dictionary } from './types'; | ||
*/ | ||
export declare type Rename<SomeObject, Prefix extends string, Suffix extends string> = { | ||
export type Rename<SomeObject, Prefix extends string, Suffix extends string> = { | ||
[Key in keyof SomeObject as `${Prefix}${Key & string}${Suffix}`]: SomeObject[Key]; | ||
@@ -108,0 +108,0 @@ }; |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare type RequiredProperties<Something, Keys extends keyof Something> = Something & Required<Pick<Something, Keys>>; | ||
export type RequiredProperties<Something, Keys extends keyof Something> = Something & Required<Pick<Something, Keys>>; |
@@ -29,3 +29,3 @@ import { Keys, Primitive } from './utils.types'; | ||
*/ | ||
export declare type ExtractPath<SomeObject> = SomeObject extends (infer ArrayType)[] ? `${number}` | `${number}.${ExtractPath<ArrayType>}` : Keys<SomeObject, string> | ExtractNestedPath<SomeObject, Keys<SomeObject, string>>; | ||
export type ExtractPath<SomeObject> = SomeObject extends (infer ArrayType)[] ? `${number}` | `${number}.${ExtractPath<ArrayType>}` : Keys<SomeObject, string> | ExtractNestedPath<SomeObject, Keys<SomeObject, string>>; | ||
/** | ||
@@ -39,3 +39,3 @@ * String path for child properties from a given object. | ||
*/ | ||
declare type ExtractNestedPath<SomeObject, PropName extends string> = PropName extends keyof SomeObject ? SomeObject[PropName] extends SomeObject ? `${PropName}.${Keys<SomeObject[PropName], string>}${any}` : SomeObject[PropName] extends SomeObject[] ? `${PropName}.${number}` | `${PropName}.${number}.${Keys<SomeObject, string>}${any}` : `${PropName}.${ExtractPath<Exclude<SomeObject[PropName], Function | Primitive>>}` : never; | ||
type ExtractNestedPath<SomeObject, PropName extends string> = PropName extends keyof SomeObject ? SomeObject[PropName] extends SomeObject ? `${PropName}.${Keys<SomeObject[PropName], string>}${any}` : SomeObject[PropName] extends SomeObject[] ? `${PropName}.${number}` | `${PropName}.${number}.${Keys<SomeObject, string>}${any}` : `${PropName}.${ExtractPath<Exclude<SomeObject[PropName], Function | Primitive>>}` : never; | ||
/** | ||
@@ -63,3 +63,3 @@ * Extracts the property type for the given path from the provided object. | ||
*/ | ||
export declare type ExtractType<SomeObject, Path extends ExtractPath<SomeObject>> = Path extends keyof SomeObject ? SomeObject[Path] : Path extends `${infer Property}.${infer RemainingPath}` ? ExtractType<SomeObject[keyof SomeObject & Property], ExtractPath<SomeObject[keyof SomeObject & Property]> & RemainingPath> : SomeObject extends any[] ? SomeObject[number] : never; | ||
export type ExtractType<SomeObject, Path extends ExtractPath<SomeObject>> = Path extends keyof SomeObject ? SomeObject[Path] : Path extends `${infer Property}.${infer RemainingPath}` ? ExtractType<SomeObject[keyof SomeObject & Property], ExtractPath<SomeObject[keyof SomeObject & Property]> & RemainingPath> : SomeObject extends any[] ? SomeObject[number] : never; | ||
/** | ||
@@ -90,5 +90,5 @@ * Extracts the property paths of the provided object that match the given type. | ||
*/ | ||
export declare type ExtractPathByType<SomeObject, Type> = keyof { | ||
export type ExtractPathByType<SomeObject, Type> = keyof { | ||
[Path in ExtractPath<SomeObject> as ExtractType<SomeObject, Path> extends (infer ArrayType)[] ? ArrayType extends Type ? `${Path}.${number}` : Type extends (infer TargetArrayType)[] ? TargetArrayType extends ArrayType ? Path : never : never : ExtractType<SomeObject, Path> extends Type ? Path : never]: any; | ||
}; | ||
export {}; |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare type AnyFunction<ReturnType = any> = (...args: any[]) => ReturnType; | ||
export type AnyFunction<ReturnType = any> = (...args: any[]) => ReturnType; | ||
/** | ||
@@ -13,3 +13,3 @@ * TypeScript type non-primitives. Array or Record with all possible types. | ||
*/ | ||
export declare type NonPrimitive = Array<any> | Record<any, any>; | ||
export type NonPrimitive = Array<any> | Record<any, any>; | ||
/** | ||
@@ -20,3 +20,3 @@ * TypeScript type primitives. Basically every type possible except objects or arrays. | ||
*/ | ||
export declare type Primitive = string | number | boolean | bigint | undefined | null | symbol | AnyFunction; | ||
export type Primitive = string | number | boolean | bigint | undefined | null | symbol | AnyFunction; | ||
/** | ||
@@ -30,3 +30,3 @@ * Retrieves the keys of a determinate type from a provided interface. | ||
*/ | ||
export declare type Keys<SomeObject, Type> = Extract<keyof SomeObject, Type>; | ||
export type Keys<SomeObject, Type> = Extract<keyof SomeObject, Type>; | ||
/** | ||
@@ -39,3 +39,3 @@ * Object where all its properties are strings, and the value of them is defined by the type of | ||
*/ | ||
export declare type Dictionary<T = any> = Record<string, T>; | ||
export type Dictionary<T = any> = Record<string, T>; | ||
/** | ||
@@ -47,4 +47,4 @@ * Makes all the properties of the T type optional in depth. | ||
*/ | ||
export declare type DeepPartial<T> = { | ||
export type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends NonPrimitive ? T[P] extends AnyFunction ? T[P] : DeepPartial<T[P]> : T[P]; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106560