UNPKG

@xylabs/typeof

Version:

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

10 lines 536 B
import type { TypeOfTypes } from './TypeOfTypes.ts'; /** * Validates that a value matches the expected type, returning the value and any errors. * @param typeName - The expected type name. * @param value - The value to validate. * @param optional - If true, undefined values are accepted without error. * @returns A tuple of [value or undefined, array of errors]. */ export declare const validateType: <T>(typeName: TypeOfTypes, value: T, optional?: boolean) => [T | undefined, Error[]]; //# sourceMappingURL=validateType.d.ts.map