UNPKG

type-checker-handler

Version:

An advanced Type Checker that checks and handles type for the param name on your function.

24 lines (23 loc) 1.13 kB
import { JsTypes } from "../enums"; /** Checks if the type of the given parameter matches the expected type. @param {object} options - An object that contains the parameter name, the expected type, and an optional error message. @param {string} options.paramName - The name of the parameter to be checked. @param {string} options.expectedType - The expected type of the parameter. @param {string} options.errorMessage - An optional custom error message to be thrown if the type check fails. @throws {TypeError} - If the type of the parameter does not match the expected type. */ declare function typeCheck({ paramName, expectedType, errorMessage, }: { paramName: string; expectedType: JsTypes; errorMessage?: any; }): void; declare function typeCheckJs({ paramName, expectedType, paramType, errorMessage, }: { paramName: string; paramType: JsTypes; expectedType: JsTypes; errorMessage?: any; }): void; declare function typeCheckFunc(func: Function, expectedTypes: Array<string>): void; export { typeCheck, typeCheckJs, typeCheckFunc }; //# sourceMappingURL=typeCheck.d.ts.map