You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I guess it should be an easy fix (look for all | null in the code), but as I'm literally discovering the lib, I'm not too confident on making a PR for now.
The text was updated successfully, but these errors were encountered:
yeah, you are completely correct. I am really not sure why we have these weird null-based signatures - perhaps to comply with existing (pre-TS) code? Passing null to an optional argument would work fine though, provided we test those values with simple if (!fg) ....
Passing null to an optional argument would work fine though, provided we test those values with simple if (!fg) ....
Sure, and you'll have to do the nullish check anyway because the default value for optional arguments is undefined. Calling draw(5, 4, "@") would be the same as calling draw(5, 4, "@", undefined, undefined).
Hello, I'm just trying rot.js, and I noticed that several functions have optional parameters that are typed as
SomeType | null
(like here).The issue is that TypeScript does not consider those parameters as optional: you either give a value, or an explicit
![image](https://user-images.githubusercontent.com/3216752/159046340-4b7cd19a-2bc5-48d8-b464-1244050447f0.png)
null
:A more correct function signature would be
I guess it should be an easy fix (look for all
| null
in the code), but as I'm literally discovering the lib, I'm not too confident on making a PR for now.The text was updated successfully, but these errors were encountered: