UNPKG

corello

Version:

Main Kernel

51 lines (50 loc) 2.52 kB
export type TClass<T = any> = { new (...args: any[]): T; }; export type TAbstractClass<T = any> = abstract new (...args: any[]) => T; export type TDeepPartial<T> = { [P in keyof T]?: TDeepPartial<T[P]>; }; export type THashMap<T = {}> = Record<PropertyKey, T>; export type TOptional<T> = T | undefined; export type TNullable<T> = T | null; export type TClassDecorator<T> = (t: T) => void | T; export type TGuess<T> = T extends infer R ? R : never; export interface IInjectable { dispose(): void; } export declare function hasParentClass(childClass: TClass | TAbstractClass, parentClass: TClass | TAbstractClass): boolean; export declare const isFn: (val: any) => boolean; export declare const extractProperties: (obj: any) => { prop: string; descriptor: PropertyDescriptor | undefined; }[]; /** * * @param instance `any` object instance * @param methodPrefix passing a value here will pick the methods to be included in the result. possible values: `empty string` | `string prefix`, if passed empty string, this will extract the object with all methods avaialble. if a string is passed, then it will determine the methods that start with this prefix to be included. * @param ignoreGetters boolean, exclude getters. * @param both boolean, indicates whether to include both, properties and methods. * @returns By default, this will return an object containing properties only. if you pass the second param `methodPrefix` then the object will contain the methods specified, if the third param `both` is passed true then it will return the object with props and methods */ export type TExtractOptions<T, P = (name: string) => boolean> = { instance: T; methodPredicate?: P; withObjProps?: boolean; }; export declare const extract: <T>({ instance, methodPredicate, withObjProps }: TExtractOptions<T>) => any; export type TSafeStringKey<K, S extends string> = K extends `${S}${Capitalize<infer _R & string>}` ? K : never; export type TMethods<T = {}> = Pick<T, { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]>; export type TProps<T = {}> = Pick<T, { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]>; export type TPickStartsWith<T, S extends string> = { [K in TSafeStringKey<keyof T, S>]: T[K]; }; export declare const isDate: (obj: any) => boolean; export declare const isClass: (obj: any) => boolean; export declare const isPrimitive: (inputValue: any) => boolean; export declare const is_sym: unique symbol; export declare const uid: () => string;