From f5ae414d822f89b4da8bbbcf59d6a5a5cbcf1dde Mon Sep 17 00:00:00 2001 From: Sasial <44125644+sasial-dev@users.noreply.github.com> Date: Sun, 11 Feb 2024 07:57:18 +1000 Subject: [PATCH] refactor(decorators): allow `@Command` to infer name --- src/shared/core/decorators.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shared/core/decorators.ts b/src/shared/core/decorators.ts index 72673874..7ec50e8f 100644 --- a/src/shared/core/decorators.ts +++ b/src/shared/core/decorators.ts @@ -19,10 +19,13 @@ export function Commander(options?: CommanderOptions): ClassDecorator { }; } -export function Command(options: CommandOptions): MethodDecorator { +export function Command(options?: Partial): MethodDecorator { return (target, key) => { const commandData: CommandMetadata = { - options, + options: { + name: key, + ...options, + }, func: target[key], }; MetadataReflect.defineMetadata(