diff options
| author | Shinigami <[email protected]> | 2023-05-04 16:42:29 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-04 16:42:29 +0200 |
| commit | 2e9ed960e3a11e4dcb78a434563fc04890c00c3d (patch) | |
| tree | 566aa44b9bb085b8a42c6f211b7ea93af4d8408f /src/utils | |
| parent | 0740aa0da3b2ac1da4fd8a134d650162457552b4 (diff) | |
| download | faker-2e9ed960e3a11e4dcb78a434563fc04890c00c3d.tar.xz faker-2e9ed960e3a11e4dcb78a434563fc04890c00c3d.zip | |
chore: rename generics (#2046)
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>>; |
