serde-ts/dist/utils.d.ts

31 lines
1.4 KiB
TypeScript

export type Nullable<T> = T | undefined;
export interface Morphism<T = any, U = any> {
(value: T): U;
}
export type Primitive = string | number | boolean | symbol | bigint | null | undefined;
export interface ToString {
toString(): string;
}
export declare function isObject(value: any): value is object;
export declare function isPlainObject(value: any): value is object;
export declare function isFunction(value: any): value is Function;
export declare function isIterable(value: any): value is Iterable<any>;
export declare function isString(value: any): value is string;
export declare function isNumber(value: any): value is number;
export type Constructor<T = any> = new (...args: any[]) => T;
export declare class IterResult {
static Next<T>(value: T): IteratorResult<T>;
static Done<T>(): IteratorResult<T>;
}
export declare function Null(...args: any): null;
export declare const PrimitivePrototype: Readonly<{
readonly undefined: typeof Null;
readonly boolean: BooleanConstructor;
readonly number: NumberConstructor;
readonly bigint: BigIntConstructor;
readonly string: StringConstructor;
readonly symbol: SymbolConstructor;
readonly object: ObjectConstructor;
readonly function: FunctionConstructor;
}>;
export declare function type(value: any): Function | ObjectConstructor | SymbolConstructor | ArrayConstructor | BooleanConstructor | NumberConstructor | BigIntConstructor | StringConstructor | FunctionConstructor;