aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShinigami92 <[email protected]>2022-01-29 18:36:39 +0100
committerShinigami <[email protected]>2022-01-29 18:43:07 +0100
commit698b6bd33a574dabd303ac30870046b333dd4ea8 (patch)
tree6f98f805bf74cae3d301b05f99f258c111915c4b /src
parent4ecdb506f6388dd1b8b83cb4dec42973aae7323e (diff)
downloadfaker-698b6bd33a574dabd303ac30870046b333dd4ea8.tar.xz
faker-698b6bd33a574dabd303ac30870046b333dd4ea8.zip
chore: remove types from objectElement
Diffstat (limited to 'src')
-rw-r--r--src/random.ts7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/random.ts b/src/random.ts
index 64fd6948..1bd0010b 100644
--- a/src/random.ts
+++ b/src/random.ts
@@ -116,6 +116,7 @@ export class Random {
return arrayCopy.slice(min);
}
+ // TODO @Shinigami92 2022-01-28: This function needs types
/**
* Takes an object and returns a random key or value.
*
@@ -123,11 +124,7 @@ export class Random {
* @param object
* @param field
*/
- // TODO @Shinigami92 2022-01-11: Not sure if these generic types are correct
- objectElement<T extends any, Key extends keyof T>(
- object: T = { foo: 'bar', too: 'car' } as unknown as T,
- field: Key
- ): T[Key] {
+ objectElement(object: any = { foo: 'bar', too: 'car' }, field?: string) {
const array = Object.keys(object);
const key = this.faker.random.arrayElement(array);