Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: random.arrayElement (and probably others) should support ReadonlyArray #166

Closed
stefanprobst opened this issue Jan 16, 2022 · 0 comments · Fixed by #189
Closed

types: random.arrayElement (and probably others) should support ReadonlyArray #166

stefanprobst opened this issue Jan 16, 2022 · 0 comments · Fixed by #189
Assignees
Labels
c: feature Request for new feature

Comments

@stefanprobst
Copy link

Describe the bug

the new types in 6.0.0-alpha.3 (thanks!) don't handle cases where the DT types allowed ReadonlyArray, e.g. random.arrayElement.

Reproduction

import faker from '@faker-js/faker'

const items = ['one', 'two', 'three'] as const

const pick = faker.random.arrayElement(items)

also note, that the other way around would be fine:

https://www.typescriptlang.org/play?#code/CYUwxgNghgTiAEAzArgOzAFwJYHtX1higE8BRCEAWxFQwB4AVAPgAosMqBnALngEEYRYoyYBKXgwBQksHk4Z4cKMDwRiAofAC88ANoByPCH0AaePowB3HKfMYAFnGMBdAp3izU86YRLkqNBgsSiqoahokotIA9NHwALSJ0qCQsAgo6Nh4iiDKquqCfhTUtCJsHJQ88ABKuaHhhcLM4vBSMnIKvsTaeoaoxmYW1rYWjiAu0iH5EWTFgSxdokA

Additional Info

No response

@stefanprobst stefanprobst added the s: pending triage Pending Triage label Jan 16, 2022
@Shinigami92 Shinigami92 added the c: feature Request for new feature label Jan 16, 2022
@github-actions github-actions bot removed the s: pending triage Pending Triage label Jan 16, 2022
@prisis prisis added this to the v6.0.0 milestone Jan 16, 2022
@clarkerican clarkerican linked a pull request Jan 17, 2022 that will close this issue
@clarkerican clarkerican self-assigned this Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants