blob: 705d02d11e2f51ea58eb6cafe8fe569c0902daa9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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<MethodOf<ObjectType, Signature>>;
|