• Defines a WinterTC middleware function with type inference.

    A convenience helper that ensures the provided handler conforms to the WinterTcMiddlewareFn signature while preserving exact parameter and return types. This allows TypeScript to infer narrower types in the handler body without needing explicit annotations.

    Use this when defining middleware functions to get accurate type checking and IntelliSense without sacrificing type safety.

    Parameters

    Returns WinterTcMiddlewareFn

    The same handler, typed as WinterTcMiddlewareFn.

    const loggerMiddleware = defineWinterTcMiddleware(async (request, next) => {
    console.log(`${request.method} ${request.url}`);
    const response = await next(request);
    console.log(`${response.status}`);
    return response;
    });

    IMPORT_PATH: "@daiso-tech/core/http-router/contracts"