Open xDivisionByZerox opened 1 month ago
IMO we clearly define our needs/requirements. If you choose to ignore them using js, non strict ts or unsafe casts, then you are on your own.
IMO we clearly define our needs/requirements. If you choose to ignore them using js, non strict ts or unsafe casts, then you are on your own.
I don't know if I agree with this statement, especially since TypeScripts default is still non-strict mode.
Team Decision
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? 🤔
Can you please explain to me what exactly do i have to do, like do i have to types for this ?
@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. Could you please explain what documentation do you want where?
@xDivisionByZerox I'm not exactly sure what should be done for this issue either. Could you please explain what documentation do you want where?
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.
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