-
-
Notifications
You must be signed in to change notification settings - Fork 943
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
array-like elements have default arguments which violate genericity #219
Comments
I assume the only way to really fix this, is to fully remove the default and force an argument to be passed in. |
It seems the violation happens when the argument is undefined / empty. Are we trying to achieve const a: number = randomize<number>();
console.log(a); // 1
const b = randomize();
console.log(b); // "a" or else we may have to think of other ways |
Yeah, but sadly this is not possible due to TS is only at compile time. |
Yes if we've to change it. At least, generic specialization in TS is not possible. |
This function is marked as deprecated (for removal in v7) and we already want to get rid of the default Maybe we should just close this issue? |
Isn't #589 the fix for this issue? |
Blocked by #893 |
Team Decision Can be implemented without #893 We want this for v8.0 |
Describe the bug
I was reviewing https://github.com/faker-js/faker/pull/189/files and I noticed that
randomize
supports generic results, but there's an issue with the arguments having a default.Consider:
This would return a string, which violates the type.
Reproduction
TypeScript Playground Link
Additional Info
No response
The text was updated successfully, but these errors were encountered: