npm / immutable
immutable
What changed in immutable 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
23 breaking4 security1 deprecations23 new APIs and options2 performance3 behavior and defaults1 tooling19 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initimmutable 534 changes
Breaking changes 11
On a lazy Seq of unknown size, has(index) checks whether the index exists instead of searching for a value equal to the index.
Removed the deprecated Collection.isAssociative method; use isAssociative directly.
Removed the deprecated Collection.isIndexed method; use isIndexed directly.
Removed the deprecated Collection.isIterable method; use isIterable directly.
Removed the deprecated Collection.isKeyed method; use isKeyed directly.
Removed the deprecated Collection.isOrdered method; use isOrdered directly.
Immutable no longer exports a default object containing its API; import named exports or use a namespace import.
Removed deprecated Map.of; use Map with an entry collection or object instead.
TypeScript Map definitions now more closely match simple objects, with get returning the value type for a known key and rejecting unknown keys.
Range now requires at least defined start and end values; use Range(0, Infinity) for an infinite range.
Fixed the return type of Map and Set sort.
Security 4
DoS patches for CVE-2026-59879 and CVE-2026-59880 were ported onto branch 3.x.
Guards oversized bounds in setListBounds, addressing a security vulnerability affecting List.
Indexes large hash-collision buckets for faster lookups in Map.
Immutable is vulnerable to Prototype Pollution
Fixes and other changes 19
TypeScript accepts a value typed KeyPath wherever a path is taken.
Fixes keySeq on a lazy indexed Seq of unknown size.
TypeScript types Record#getIn from the Record's properties, like MapOf#getIn.
Deleting or removing a required key now returns a MapOf without that key instead of never; deleting an optional key still keeps the type.
Reverse iteration of an indexed lazy Sequence of unknown size no longer produces NaN keys.
Slicing a zipped Sequence of unknown size from the end no longer causes a stack overflow.
Reverse iteration now produces correct keys for interposed Sequences.
Reverse iteration now produces correct keys for filtered indexed Seqs.
skipWhile and skipUntil on indexed Seqs now renumber iterator keys from 0; entries() no longer throws when exhausted, also fixing chained map/filter iteration and equals.
takeLast(0) now works on a Sequence of unknown size.
List now preserves undefined values when grown past 32 elements.
Repeat.lastIndexOf now returns size - 1 instead of size for the last index.
The type for reduce is improved when no initial value is given.
The reverseFactory iterator now reads reversedSequence.size instead of this, fixing reversed-sequence iteration behavior.
Fixed an issue with an empty list that is a singleton.
Fixed type inference for first().
Fixed hashCode for OrderedMap and OrderedSet so equal objects return the same hashCode.
Fixed type inference for last().
Fixed the return type of Map and Set sortBy.
immutable 442 changes
Breaking changes 12
getIn() no longer throws when encountering a missing path and warns instead of throwing for a bad path.
Hash speed was improved and collisions for common values avoided; some hash values and iteration order in Maps may change.
The predicate functions isCollection, isKeyed, isIndexed, and isAssociative moved from Iterable to top-level exports.
isImmutable() now returns true for collections currently within a withMutations() call.
Iterable was renamed to Collection; aliases with the existing names remain to ease transition.
The TypeScript Iterable<T> tuple typing was removed from Map constructor types; the runtime behavior still works.
map.concat() is now an alias for map.merge(), which may affect code relying on their previously different behavior.
Node buffers are no longer considered value-equal.
Record is no longer an Immutable Collection; isCollection(record) returns false, and its sequence API, delete(), and clear() are unavailable.
Seq.of() was removed because it cannot be correctly typed; use Seq([1, 2, 3]) instead.
Seq() no longer detects iterators; iterables can still be provided.
toJSON() now performs a shallow conversion; toJS() remains the deep conversion.
Deprecations 1
The Cursor API is officially deprecated; the notes recommend immutable-cursor instead.
New APIs and options 23
Collection types now implement the ES6 iterable protocol.
zipAll() is added to indexed collections.
toJSON() is available on Collection and collection types for shallow conversion.
The update method is added to Collection and its subtypes.
first() accepts an optional notSetValue argument.
A functional API for get() supports Immutable.js collections and plain Objects and Arrays.
The renamed isCollection() predicate replaces isIterable(); the old name remains as an alias.
isList() is exported from the immutable module as a top-level predicate.
isMap() is exported from the immutable module as a top-level predicate.
isOrderedMap() is exported from the immutable module as a top-level predicate.
isOrderedSet() is exported from the immutable module as a top-level predicate.
isRecord() is exported from the immutable module as a top-level predicate.
isSeq() is exported from the immutable module as a top-level predicate.
isSet() is exported from the immutable module as a top-level predicate.
isStack() is exported from the immutable module as a top-level predicate.
isValueObject() detects objects implementing equals() and hashCode().
last() accepts an optional notSetValue argument.
deleteAll() is added to Map.
A functional API for set() supports Immutable.js collections and plain Objects and Arrays.
Immutable.js adds support for Transducers.
The ValueObject interface can be implemented by objects that should behave as values and serve as Map keys or Set entries.
wasAltered() is added to mutable-capable collection types.
A new zipAll() method is available.
Performance 2
An ES module is bundled and distributed so Webpack and Rollup can tree-shake for smaller builds.
toJS performance improved; the notes report a cursory test more than 10% faster than the compared releases.
Behavior and default changes 3
fromJS() supports Sets, and its reviver receives the key path to each translated value.
List.merge is now an alias for List.concat.
Seq() supports Sets.
Tooling 1
TypeScript and Flow definitions were rewritten for higher quality and accuracy, with support for TypeScript 3 and strictNullChecks and current Flow.