From b2ee789bc428d8cf0efaf2ee074f987cf07b9171 Mon Sep 17 00:00:00 2001 From: Antony Rizzitelli Date: Tue, 10 Nov 2026 04:05:20 +0000 Subject: [PATCH] docs(routes): list every ProcessCallback TypeError and describe the decorator target --- src/parameter-decorators.ts | 6 ++++-- src/routes.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/parameter-decorators.ts b/src/parameter-decorators.ts index 2729ed9..1b143ae 100644 --- a/src/parameter-decorators.ts +++ b/src/parameter-decorators.ts @@ -19,7 +19,8 @@ import { /** * Set the ParameterProvider on a Handler or Property. * - * @param target Controller class + * @param target Decorator target: the prototype of the decorated member, whose + * constructor is the controller class * @param key Handler key or Property key * @param index If used on a handler, parameter index * @param provider ParameterProvider @@ -58,7 +59,8 @@ export function SetParameterProvider< /** * Add a ParameterModifier on a Handler or Property. * - * @param target Controller class + * @param target Decorator target: the prototype of the decorated member, whose + * constructor is the controller class * @param key Handler key or Property key * @param index If used on a handler, parameter index * @param transformer ParameterModifier diff --git a/src/routes.ts b/src/routes.ts index 575f818..9be2d86 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -103,7 +103,8 @@ function handlerSegment( /** * Register a RouteHandler to the API from a decorator. * - * @param target Controller class + * @param target Decorator target: the prototype of the decorated method, whose + * constructor is the controller class * @param key Handler key * @param descriptor Handler descriptor * @param route Handler mode (prefix, handler, postfix, websocket), HTTP method, @@ -111,6 +112,12 @@ function handlerSegment( * priority are optional * @returns `{ id }`, an object because {@link Route} returns it as a method * decorator's property descriptor + * @throws {TypeError} When the descriptor has no `value`, because the decorated + * member is not a method + * @throws {TypeError} When `target.constructor` is a class that + * `Controller` did not create, so it has no location; a static method's + * target is the class itself, whose constructor is `Function` + * @throws {TypeError} When `key` is a symbol and the route gives no location * @throws {TypeError} When a parameter of the handler receives `@Connection`, * set on it or inherited from a parent controller's method of the same name, * and the mode is neither `websocket` nor `monitor`