From 32ddcbef4d13975807854f41b8a81b4bd2715ab4 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Mon, 8 Aug 2022 14:04:10 +0200 Subject: [PATCH] Make `Emittery.mixin` type support arguments in constructor Fixes #79 Closes #101 --- index.d.ts | 2 +- index.test-d.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 9429799..4204a51 100644 --- a/index.d.ts +++ b/index.d.ts @@ -292,7 +292,7 @@ declare class Emittery< static mixin( emitteryPropertyName: string | symbol, methodNames?: readonly string[] - ): (klass: T) => T; // eslint-disable-line @typescript-eslint/prefer-function-type + ): (klass: T) => T; // eslint-disable-line @typescript-eslint/prefer-function-type /** Subscribe to one or more events. diff --git a/index.test-d.ts b/index.test-d.ts index 2bd77fa..7b28577 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -279,3 +279,8 @@ type AnyListener = (eventData?: unknown) => void | Promise; Emittery.mixin('emittery')(class { test() {} }); + +// Mixin type - arguments in constructor +Emittery.mixin('emittery')(class { // eslint-disable-line @typescript-eslint/no-extraneous-class + constructor(argument: string) {} // eslint-disable-line @typescript-eslint/no-useless-constructor +});