import * as ObjectCheck from "../object"; export enum InstanceOfErrorCode { NOT_INSTANCE_OF = "NOT_INSTANCE_OF" } export type InstanceOfErrorCodeType = ObjectCheck.ObjectErrorCode|InstanceOfErrorCode; export function checkInstanceOf (mixed : any, clazz : { new(...args : any[]) : T, name : string }) : undefined|InstanceOfErrorCodeType { return ObjectCheck.checkObjectPredicate(mixed, (obj) => { if (obj instanceof clazz) { return undefined; } return InstanceOfErrorCode.NOT_INSTANCE_OF; }) }