-
-
Notifications
You must be signed in to change notification settings - Fork 933
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
Extend Docs to Describe Expected Usage with TypeScript #3006
Comments
IMO we clearly define our needs/requirements. |
I don't know if I agree with this statement, especially since TypeScripts default is still non-strict mode. |
Team Decision
|
helpers.arrayElement()
breaks when not using TS strict mode
Can you please explain to me what exactly do i have to do, like do i have to types for this ? |
@AmaanRS I'm not sure if I understand correctly. Are you asking for the tasks to do to work on the issue? 🤔 |
@AmaanRS This is a documentation task, so it doesn't need any code changes. @xDivisionByZerox I'm not exactly sure what should be done for this issue either. |
Of couse. IMO the TypeScript section of our docs should add a note box hinting the user that using faker without (TS) strict mode might lead to unexpected behaviour which will not be worked around from our side. |
Note
The updated requirements for the issues can be found in this comment.
Pre-Checks
Describe the bug
In a project where TypeScript is not configured to run in strict mode, the function
faker.helpers.arrayElement
can be called withnull
andundefined
, which leads to errors during runtime.Minimal reproduction code
https://stackblitz.com/edit/faker-js-demo-c67mtj?file=index.ts
Additional Context
This might be true for ALL functions, as
null
is assignable to everything in non-strict mode.Environment Info
Which module system do you use?
Used Package Manager
pnpm
The text was updated successfully, but these errors were encountered: