/** * Type Guards * * Type Guard functions for runtime type checking * * @module utils/type-guards */ import type { InternalRequest, InternalResponse, InternalSocket, InternalError } from '../types/internal'; /** * Check InternalRequest type * * @param req - Request object * @returns Whether it is InternalRequest type * * @example * ```typescript * if (isInternalRequest(req)) { * req.params = { id: '123' } // OK * } * ``` */ export declare function isInternalRequest(req: any): req is InternalRequest; /** * Check InternalResponse type * * @param res - Response object * @returns Whether it is InternalResponse type * * @example * ```typescript * if (isInternalResponse(res)) { * res.req = req // OK * } * ``` */ export declare function isInternalResponse(res: any): res is InternalResponse; /** * Check InternalSocket type * * @param socket - Socket object * @returns Whether it is InternalSocket type * * @example * ```typescript * if (isInternalSocket(socket)) { * const encrypted = socket.encrypted // OK * } * ``` */ export declare function isInternalSocket(socket: any): socket is InternalSocket; /** * Check InternalError type * * @param error - Error object * @returns Whether it is InternalError type * * @example * ```typescript * if (isInternalError(error)) { * const code = error.code // OK * } * ``` */ export declare function isInternalError(error: Error): error is InternalError; /** * Check if Request has params field * * @param req - Request object * @returns Whether params field exists */ export declare function hasParams(req: Request): req is Request & { params: Record; }; /** * Check if Request has query field * * @param req - Request object * @returns Whether query field exists */ export declare function hasQuery(req: Request): req is Request & { query: Record; }; /** * Check if Response has req field * * @param res - Response object * @returns Whether req field exists */ export declare function hasReq(res: Response): res is Response & { req: Request; }; /** * Check if Response has app field * * @param res - Response object * @returns Whether app field exists */ export declare function hasApp(res: Response): res is Response & { app: any; }; /** * Check if Error has code field * * @param error - Error object * @returns Whether code field exists */ export declare function hasCode(error: Error): error is Error & { code: string; }; /** * Check if Error has validationErrors field * * @param error - Error object * @returns Whether validationErrors field exists */ export declare function hasValidationErrors(error: Error): error is Error & { validationErrors: any; }; //# sourceMappingURL=type-guards.d.ts.map