UNPKG

2.61 kBTypeScriptView Raw
1export { ArrayUtils } from './array-utils';
2export { Prioritizeable } from './prioritizeable';
3type UnknownObject<T extends object> = Record<string | number | symbol, unknown> & {
4 [K in keyof T]: unknown;
5};
6export type Deferred<T> = {
7 [P in keyof T]: Promise<T[P]>;
8};
9export type MaybeArray<T> = T | T[];
10export type MaybeNull<T> = {
11 [P in keyof T]: T[P] | null;
12};
13export type MaybePromise<T> = T | PromiseLike<T>;
14export type MaybeUndefined<T> = {
15 [P in keyof T]?: T[P] | undefined;
16};
17export type Mutable<T> = {
18 -readonly [P in keyof T]: T[P];
19};
20export type RecursivePartial<T> = {
21 [P in keyof T]?: T[P] extends (infer I)[] ? RecursivePartial<I>[] : RecursivePartial<T[P]>;
22};
23export declare function isBoolean(value: unknown): value is boolean;
24export declare function isString(value: unknown): value is string;
25export declare function isNumber(value: unknown): value is number;
26export declare function isError(value: unknown): value is Error;
27export declare function isErrorLike(value: unknown): value is Error;
28export declare function isFunction<T extends (...args: unknown[]) => unknown>(value: unknown): value is T;
29/**
30 * @returns whether the provided parameter is an empty JavaScript Object or not.
31 */
32export declare function isEmptyObject(obj: unknown): obj is object;
33export declare function isObject<T extends object>(value: unknown): value is UnknownObject<T>;
34export declare function isUndefined(value: unknown): value is undefined;
35/**
36 * @param value value to check.
37 * @param every optional predicate ran on every element of the array.
38 * @param thisArg value to substitute `this` with when invoking in the predicate.
39 * @returns whether or not `value` is an array.
40 */
41export declare function isArray<T>(value: unknown, every?: (value: unknown) => unknown, thisArg?: unknown): value is T[];
42export declare function isStringArray(value: unknown): value is string[];
43/**
44 * Creates a shallow copy with all ownkeys of the original object that are `null` made `undefined`
45 */
46export declare function nullToUndefined<T>(nullable: MaybeNull<T>): MaybeUndefined<T>;
47/**
48 * Throws when called and statically makes sure that all variants of a type were consumed.
49 */
50export declare function unreachable(_never: never, message?: string): never;
51/**
52 * @returns whether the provided parameter is defined.
53 */
54export declare function isDefined<T>(arg: T | null | undefined): arg is T;
55/**
56 * @returns whether the provided parameter is undefined or null.
57 */
58export declare function isUndefinedOrNull(obj: unknown): obj is undefined | null;
59//# sourceMappingURL=types.d.ts.map
\No newline at end of file