UNPKG

@xylabs/typeof

Version:

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

11 lines 689 B
import type { TypeOfTypes } from './TypeOfTypes.ts'; /** * Invokes the callback if the value matches the specified type, with an optional additional predicate. * @param typeName - The expected type name to match against. * @param value - The value to check. * @param trueFunc - The callback to invoke if the type matches. * @param isFunc - Optional additional predicate that must also return true. * @returns The result of trueFunc if the type matches (and isFunc passes), or undefined. */ export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined; //# sourceMappingURL=ifTypeOf.d.ts.map