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
The TypeScript signature of methods like first, last, etc that take a notSetValue is:
first<NSV>(notSetValue?: NSV): V|NSV;
In TypeScript (at least in 4.1.2) if no argument is passed, NSV becomes unknown, not undefined as documented.
Possible fix:
first<NSV=undefined>(notSetValue?: NSV): V|NSV;
I found this PR but it never got merged: #1653. I think = undefined is less verbose as it doesn't create a new overload. If going with this overload approach, the correct declaration would be (instead of the one in the PR):
What happened
The TypeScript signature of methods like
first
,last
, etc that take anotSetValue
is:In TypeScript (at least in
4.1.2
) if no argument is passed,NSV
becomesunknown
, notundefined
as documented.Possible fix:
I found this PR but it never got merged: #1653. I think
= undefined
is less verbose as it doesn't create a new overload. If going with this overload approach, the correct declaration would be (instead of the one in the PR):I'd create a PR but didn't know how you wanted to handle #1653.
Note that other methods that accept a
notSetValue
argument probably suffer from the same issue.Thank you.
The text was updated successfully, but these errors were encountered: