function Custom
Since 0.2.0
Custom<T = unknown>(
name: string,
metadata?: Readonly<Record<string, unknown>>
): ParamSource<T>

Binds a value produced by an application-registered resolver.

The resolver is registered under the same name with registerParameterResolver. Replaces the legacy createParameterDecorator, which returned a parameter decorator and has no standard-decorator form.

Examples

Example 1

registerParameterResolver('tenant', (ctx) => ctx.request.tenant);
// …
@Params(Custom<Tenant>('tenant'))
list(tenant: Tenant) { … }

Type Parameters

T = unknown

Parameters

name: string

Custom parameter type name, matching a registered resolver

optional
metadata: Readonly<Record<string, unknown>>

Optional payload handed to the resolver

Return Type

A custom source

Usage

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