diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/types.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/utils/types.ts b/src/utils/types.ts index 8c1bfe6b..c7aaf86c 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -3,9 +3,9 @@ * * @see https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609 */ -export type LiteralUnion<T extends U, U = string> = - | T - | (U & { zz_IGNORE_ME?: never }); +export type LiteralUnion<TSuggested extends TBase, TBase = string> = + | TSuggested + | (TBase & { zz_IGNORE_ME?: never }); /** * A function that returns a value. @@ -22,18 +22,18 @@ export type Callable = ( /** * Type that represents a single method/function name of the given type. */ -export type MethodOf<ObjectType, Signature extends Callable = Callable> = { - [Key in keyof ObjectType]: ObjectType[Key] extends Signature +export type MethodOf<TObjectType, TSignature extends Callable = Callable> = { + [Key in keyof TObjectType]: TObjectType[Key] extends TSignature ? Key extends string ? Key : never : never; -}[keyof ObjectType]; +}[keyof TObjectType]; /** * Type that represents all method/function names of the given type. */ export type MethodsOf< - ObjectType, - Signature extends Callable = Callable -> = ReadonlyArray<MethodOf<ObjectType, Signature>>; + TObjectType, + TSignature extends Callable = Callable +> = ReadonlyArray<MethodOf<TObjectType, TSignature>>; |
