chore(deps): update dependency immutable to v5 #15368
Open
+10
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^4.0.0
->^5.0.0
Release Notes
immutable-js/immutable-js (immutable)
v5.0.0
Compare Source
Breaking changes
To sum up, the big change in 5.0 is a Typescript change related to
Map
that is typed closer to the JS object. This is a huge change for TS users, but do not impact the runtime behavior. (see Improve TypeScript definition forMap
for more details)Other breaking changes are:
[BREAKING] Remove deprecated methods:
Released in 5.0.0-rc.1
Map.of('k', 'v')
: useMap([ [ 'k', 'v' ] ])
orMap({ k: 'v' })
Collection.isIterable
: useisIterable
directlyCollection.isKeyed
: useisKeyed
directlyCollection.isIndexed
: useisIndexed
directlyCollection.isAssociative
: useisAssociative
directlyCollection.isOrdered
: useisOrdered
directly[BREAKING]
OrdererMap
andOrderedSet
hashCode implementation has been fixedReleased in 5.0.0-rc.1
Fix issue implementation of
hashCode
forOrdererMap
andOrderedSet
where equal objects might not return the samehashCode
.Changed in #2005
[BREAKING] Range function needs at least two defined parameters
Released in 5.0.0-beta.5
Range with
undefined
would end in an infinite loop. Now, you need to define at least the start and end values.If you need an infinite range, you can use
Range(0, Infinity)
.Changed in #1967 by @jdeniau
[Minor BC break] Remove default export
Released in 5.0.0-beta.1
Immutable does not export a default object containing all it's API anymore.
As a drawback, you can not
immport Immutable
directly:If you want the non-recommanded, but shorter migration path, you can do this:
[TypeScript Break] Improve TypeScript definition for
Map
Released in 5.0.0-beta.1
This was previously typed as
Map<string, string | number>
and return type of
m.get('length')
orm.get('inexistant')
was typed asstring | number | undefined
.This made
Map
really unusable with TypeScript.Now the Map is typed like this:
and the return type of
m.get('length')
is typed asnumber
.The return of
m.get('inexistant')
throw the TypeScript error:If you want to keep the old definition
This is a minor BC for TS users, so if you want to keep the old definition, you can declare you Map like this:
If you need to type the Map with a larger definition
You might want to declare a wider definition, you can type your Map like this:
Keep in mind that the
MapOf
will try to be consistant with the simple TypeScript object, so you can not do this:Like a simple object, it will only work if the type is forced:
Are all
Map
methods implemented ?For now, only
get
,getIn
,set
,update
,delete
,remove
,toJS
,toJSON
methods are implemented. All other methods will fallback to the basicMap
definition. Other method definition will be added later, but as some might be really complex, we prefer the progressive enhancement on the most used functions.Fixes
Internal
Special thanks to @arnfaldur that migrated every type tests to tsd just before that.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.