From 8ce7f3ea8b1daa76097af40693d67a61e2dfbef5 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 29 Apr 2022 12:39:55 +0200 Subject: chore: fix any warnings in image module (#886) --- src/utils/types.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/utils/types.ts (limited to 'src/utils') diff --git a/src/utils/types.ts b/src/utils/types.ts new file mode 100644 index 00000000..705d02d1 --- /dev/null +++ b/src/utils/types.ts @@ -0,0 +1,17 @@ +/** + * Type that represents a single method/function name of the given type. + */ +export type MethodOf< + ObjectType, + Signature extends (...args) => unknown = (...args) => unknown +> = { + [Key in keyof ObjectType]: ObjectType[Key] extends Signature ? Key : never; +}[keyof ObjectType]; + +/** + * Type that represents all method/function names of the given type. + */ +export type MethodsOf< + ObjectType, + Signature extends (...args) => unknown = (...args) => unknown +> = ReadonlyArray>; -- cgit v1.2.3