aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2022-07-22 15:40:07 +0200
committerGitHub <[email protected]>2022-07-22 21:40:07 +0800
commit895799b23e8224eb1b623ef1d0ffd508f101389f (patch)
tree4618f67b04f51a60efabf5e61b6fa1eb6e6cf731 /src
parent9ac77b8acf2bfd008883589673e1c8106241046f (diff)
downloadfaker-895799b23e8224eb1b623ef1d0ffd508f101389f.tar.xz
faker-895799b23e8224eb1b623ef1d0ffd508f101389f.zip
test: introduce seededTests factory (#838)
Diffstat (limited to 'src')
-rw-r--r--src/utils/types.ts20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/utils/types.ts b/src/utils/types.ts
index 65c87ebf..012ad58b 100644
--- a/src/utils/types.ts
+++ b/src/utils/types.ts
@@ -8,13 +8,21 @@ export type LiteralUnion<T extends U, U = string> =
| (U & { zz_IGNORE_ME?: never });
/**
+ * Basically a function that returns a value.
+ *
+ * For some strange reason this is not the same as `Function`.
+ */
+export type Callable = (...args) => unknown;
+
+/**
* 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;
+export type MethodOf<ObjectType, Signature extends Callable = Callable> = {
+ [Key in keyof ObjectType]: ObjectType[Key] extends Signature
+ ? Key extends string
+ ? Key
+ : never
+ : never;
}[keyof ObjectType];
/**
@@ -22,5 +30,5 @@ export type MethodOf<
*/
export type MethodsOf<
ObjectType,
- Signature extends (...args) => unknown = (...args) => unknown
+ Signature extends Callable = Callable
> = ReadonlyArray<MethodOf<ObjectType, Signature>>;