UNPKG

typescanner

Version:

A simple library for implementing type guard in TypeScript.

16 lines (15 loc) 1.11 kB
import type { Condition, WouldBe } from "../types"; export declare const isString: Condition<string>; export declare const isNumber: Condition<number>; export declare const isBoolean: Condition<boolean>; export declare const isSymbol: Condition<symbol>; export declare const isBigint: Condition<bigint>; export declare const isUndefined: Condition<undefined>; export declare const isNull: Condition<null>; export declare const isDate: Condition<Date>; export declare const isUnion: <T>(value: unknown, ...conditions: Condition<T>[]) => value is T; export declare const isArray: <T>(array: unknown, ...conditions: ((value: unknown) => value is T)[]) => array is T[]; export declare const isObject: <T extends Record<string, unknown>>(value: unknown) => value is WouldBe<T>; export declare const isOptional: <T>(value: unknown, ...conditions: ((value: unknown) => value is T)[]) => value is T | undefined; export declare const isList: <T>(value: unknown, array: Exclude<T[], never[]>) => value is T; export declare const isInstanceOf: <T>(value: unknown, constructor: new (...args: any[]) => T) => value is T;