From 846a64f9934de2377800043d4765cbd02792e15e Mon Sep 17 00:00:00 2001 From: Xymorot Date: Tue, 10 Nov 2020 21:18:33 +0100 Subject: [PATCH] refactor: use type which is closer to pre-defined typescript type for answer.ts --- src/main/modules/ipc/annotations/answer.ts | 2 +- types/decorator-factory.d.ts | 1 - types/ipc-controller-method-decorator.d.ts | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) delete mode 100644 types/decorator-factory.d.ts create mode 100644 types/ipc-controller-method-decorator.d.ts diff --git a/src/main/modules/ipc/annotations/answer.ts b/src/main/modules/ipc/annotations/answer.ts index b20cff5..811db5c 100644 --- a/src/main/modules/ipc/annotations/answer.ts +++ b/src/main/modules/ipc/annotations/answer.ts @@ -1,6 +1,6 @@ import { registerHandler } from '../ipc-server'; -export function answer(channel: IpcChannel): DecoratorFactory { +export function answer(channel: IpcChannel): IpcControllerMethodDecorator { return function (target: IIpcController, propertyKey): void { registerHandler(channel, target, propertyKey); }; diff --git a/types/decorator-factory.d.ts b/types/decorator-factory.d.ts deleted file mode 100644 index e0cd938..0000000 --- a/types/decorator-factory.d.ts +++ /dev/null @@ -1 +0,0 @@ -type DecoratorFactory = (target: T, propertyKey: string, descriptor: PropertyDescriptor) => void; diff --git a/types/ipc-controller-method-decorator.d.ts b/types/ipc-controller-method-decorator.d.ts new file mode 100644 index 0000000..ce823b7 --- /dev/null +++ b/types/ipc-controller-method-decorator.d.ts @@ -0,0 +1,4 @@ +/** + * @see MethodDecorator + */ +type IpcControllerMethodDecorator = (target: IIpcController, propertyKey: string, descriptor: TypedPropertyDescriptor) => void