refactor: use type which is closer to pre-defined typescript type for answer.ts

This commit is contained in:
Xymorot 2020-11-10 21:18:33 +01:00
parent 09d609f414
commit 846a64f993
3 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import { registerHandler } from '../ipc-server';
export function answer(channel: IpcChannel): DecoratorFactory<IIpcController> {
export function answer(channel: IpcChannel): IpcControllerMethodDecorator {
return function (target: IIpcController, propertyKey): void {
registerHandler(channel, target, propertyKey);
};

View File

@ -1 +0,0 @@
type DecoratorFactory<T> = (target: T, propertyKey: string, descriptor: PropertyDescriptor) => void;

View File

@ -0,0 +1,4 @@
/**
* @see MethodDecorator
*/
type IpcControllerMethodDecorator = <T>(target: IIpcController, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => void