function resolveParameter
Since 0.1.0
resolveParameter(
ctx: IRequestContext,
): unknown | Promise<unknown>

Resolves a single parameter value from the request context. The result may be a promise (for body and custom resolvers); callers should await it.

For parameters bound to @Body, @Query, or @Param, a validated value written to request state under validatedStateKey by validation middleware takes precedence over the raw request value; presence is checked with ctx.state.has, so a schema legitimately validating to null or 0 is still honoured. @Header/@Cookie always resolve raw.

Parameters

ctx: IRequestContext

The request context

The parameter metadata

Return Type

unknown | Promise<unknown>

The resolved value (may be a promise for body/custom)

Usage

import { resolveParameter } from "decorator-plugin/src/index.ts";