-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Dictionary type - why is undefined a possible entity value #930
Comments
Because if you were to access So, rather than go with a TS type like |
that's fair enough thanks for the reply. makes sense. |
Sure. The other answer is, "We ported |
Just came up with the same question while experimenting with redux. I'd like to add here that as a side effect of this there seem to be no way of iterating through all entities without checking whether they are undefined. I mean, following the example here, if one wants to do something for all entities using I feel this is inconsistent with the
Isn't this what
Likewise, turning |
FWIW, the difference in behavior here in terms of both runtime and types is because We could hypothetically change this, but at that point we're also sorta lying with the types. Then again, that's also what the built-in @phryneas , thoughts ? |
This type is a lot older than |
Oh yeah, it's totally a breaking change and would have to be part of a 2.0, I just wanted to see if you think that changing that would be a reasonable thing to do. Okay, I'll add that to the 2.0 list, then. |
Getting the chance to use rtk for the first time, and using
createEntityAdapter
. Just coming across this and wondering why the possible value of an entity is undefined. The entity keys are created off the entity object so I can't imagine a scenario where it would be undefined. Not a big deal, but means accounting/coding for undefined every time you access an entity.Thanks.
The text was updated successfully, but these errors were encountered: