aboutsummaryrefslogtreecommitdiff
path: root/src/utils/types.ts
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2022-04-29 12:39:55 +0200
committerGitHub <[email protected]>2022-04-29 12:39:55 +0200
commit8ce7f3ea8b1daa76097af40693d67a61e2dfbef5 (patch)
tree6e974eefdb1f4a10041ecb257a7d14ef92175772 /src/utils/types.ts
parent98b6289bb94fee4cba9e5e605ea76e55a1d63128 (diff)
downloadfaker-8ce7f3ea8b1daa76097af40693d67a61e2dfbef5.tar.xz
faker-8ce7f3ea8b1daa76097af40693d67a61e2dfbef5.zip
chore: fix any warnings in image module (#886)
Diffstat (limited to 'src/utils/types.ts')
-rw-r--r--src/utils/types.ts17
1 files changed, 17 insertions, 0 deletions
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<MethodOf<ObjectType, Signature>>;