diff --git a/packages/rpc/src/decorators.ts b/packages/rpc/src/decorators.ts index 030968642..9dd63673c 100644 --- a/packages/rpc/src/decorators.ts +++ b/packages/rpc/src/decorators.ts @@ -38,7 +38,7 @@ export class RpcAction { class RpcClass { t = new RpcController; - controller(nameOrDefinition: string | ControllerDefinition) { + controller(nameOrDefinition?: string | ControllerDefinition) { if ('string' === typeof nameOrDefinition) { this.t.name = nameOrDefinition; } else { @@ -49,6 +49,10 @@ class RpcClass { addAction(name: string, action: RpcAction) { this.t.actions.set(name, action); } + + onDecorator(classType: ClassType) { + this.t.name ||= classType.name; + } } export const rpcClass: ClassDecoratorResult = createClassDecoratorContext(RpcClass);