function Params
Since 0.2.0
Params<S extends readonly ParamSource<unknown>[]>(...sources: S): <A extends SourceValues<S>, R>(
value: (...args: A) => R,
context: ClassMethodDecoratorContext
) => (...args: A) => R

Binds handler arguments to request sources, positionally.

Each source is stored as ParameterMetadata whose index is the source's position in this call.

The list is checked against the handler's own signature, so it must name EVERY parameter — one source per argument, in argument order. A shorter or longer list is a compile error rather than the silently-undefined argument the legacy parameter decorators produced. A handler that genuinely wants nothing bound simply carries no @Params.

Examples

Example 1

@Post('/')
@Params(Body<CreateWidget>(), CurrentUser<User>())
create(input: CreateWidget, user: User) { … }

Type Parameters

S extends readonly ParamSource<unknown>[]

Parameters

...sources: S

One source per handler argument, in argument order

Return Type

<A extends SourceValues<S>, R>(
value: (...args: A) => R,
context: ClassMethodDecoratorContext
) => (...args: A) => R

A method decorator

Usage

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