UNPKG

@pokt-network/pocket-js

Version:

Pocket-js core package with the main functionalities to interact with the Pocket Network.

19 lines (18 loc) 669 B
interface ITypeMap { string: string; number: number; boolean: boolean; } declare type PrimitiveOrConstructor = { new (...args: any[]): any; } | keyof ITypeMap; declare type GuardedType<T extends PrimitiveOrConstructor> = T extends { new (...args: any[]): infer U; } ? U : T extends keyof ITypeMap ? ITypeMap[T] : never; /** * A generic type guard function to verify the class of a particular object, specially used for Error checks * @param o Object to check the class for * @param className The class to check against */ export declare function typeGuard<T extends PrimitiveOrConstructor>(o: any, className: T): o is GuardedType<T>; export {};