Closed
Description
Using v4.0.0-rc.9
What happened
The documentation for asImmutable
states:
Because it [
asImmutable()
] applies to mutable collections, this operation is mutable and returns itself.
But the following Typescript example shows this not to be the case where a collection (list in this case) is empty:
let l1 = Immutable.List<number>().asMutable();
let l2 = l1.asMutable();
expect(l2).toBe(l1);
let l3 = l2.asImmutable();
expect(l3).toBe(l2); // FAILS
In my opinion asImmutable
should, per the docs, always return itself. But I raise this issue for discussion on whether the implementation or docs need to change.
Thanks