faker.helpers.objectKey returns wrong type #2718
Labels
c: bug
Something isn't working
m: helpers
Something is referring to the helpers module
wontfix
This will not be worked on
Pre-Checks
Describe the bug
When calling
faker.helpers.objectKey
with aRecord<number, *>
it declares to return anumber
, but actually returns astring
.I discovered this, when I tried to pass a mapped type to the function and got
string | number
back.Minimal reproduction code
Additional Context
This seems to be intentional on the TypeScript side.
https://stackoverflow.com/questions/51808160/keyof-inferring-string-number-when-key-is-only-a-string
Environment Info
Which module system do you use?
Used Package Manager
pnpm
The text was updated successfully, but these errors were encountered: