Skip to content

Commit

Permalink
feat(rpc): add support for class typeName in rpc class decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sa committed Oct 30, 2023
1 parent 589c79e commit 50f21f9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/rpc/src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@
*/

import { ClassType } from '@deepkit/core';
import { ClassDecoratorResult, createClassDecoratorContext, createPropertyDecoratorContext, mergeDecorator, PropertyDecoratorResult } from '@deepkit/type';
import {
ClassDecoratorResult,
createClassDecoratorContext,
createPropertyDecoratorContext,
mergeDecorator,
PropertyDecoratorResult,
reflect
} from '@deepkit/type';
import { ControllerDefinition } from './model.js';

class RpcController {
// Defaults to the name of the class
name!: string;
name: string = '';

definition?: ControllerDefinition<any>;

Expand Down Expand Up @@ -52,7 +59,7 @@ class RpcClass {
}

onDecorator(classType: ClassType) {
this.t.name ??= classType.name;
this.t.name ??= reflect(classType).typeName || classType.name;
}
}

Expand Down

0 comments on commit 50f21f9

Please sign in to comment.