-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Wrong typescript declarations for update method #1466
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
Comments
I also noticed that you can return |
@JLarky In Typescript |
Not with --strict flag
…On Sat, Dec 30, 2017, 05:02 Rémi Blaise ***@***.***> wrote:
@JLarky <https://github.com/jlarky> In Typescript undefined extends any
type, so the updater type is updater: (value?: V) => V) which is fine.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1466 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAbcu7CRYalwoY2jS3TAMPtkXapinH4ks5tFjR2gaJpZM4RLje4>
.
|
Does Immutable support --strict flag ? |
Latest rc works with most of operations ok, and `update` is one of several
that still don't. For example `first()` was returning `V` and now it
returns `V | undefined` as expected, or `filter` was `(value?: V, key?: K)
=> boolean` but now it fixed and is `(value: V, key: K) => boolean`
…On Sun, Dec 31, 2017, 09:47 Rémi Blaise ***@***.***> wrote:
Does Immutable support --strict flag ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1466 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAbchrEA09C95h2PsRl5InpJ9ZPZwvaks5tF8jMgaJpZM4RLje4>
.
|
Noticed similar issue with
should be
|
What happened
here
updater
has wrong type, should beupdater: (value?: V) => V)
if key doesn't existHow to reproduce
Here
good
works as expected,fixed
shows error message that I would expect to see in this caseObject is possibly 'undefined'
, butbad
doesn't show any errors while crashing at run time withUncaught TypeError: Cannot read property 'map' of undefined
Maybe there need to be a function that is
updateIfKeyExist
that would have(value: V) => V
type, but right now type is misleading and causes run time issues.The text was updated successfully, but these errors were encountered: