Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

Commit 0e9da4d

Browse files
committed
Merge remote-tracking branch 'origin/main' into jd-feat-tsMapObject
2 parents 47be7ee + 7cf6f8e commit 0e9da4d

File tree

12 files changed

+84
-47
lines changed

12 files changed

+84
-47
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ Dates are formatted as YYYY-MM-DD.
1010

1111
### Changed
1212

13-
- Accept Symbol as Map key. [#1859](https://github.com/immutable-js/immutable-js/pull/1859) by [jdeniau](https://github.com/jdeniau)
14-
- Optimize contructors without arguments [#1887](https://github.com/immutable-js/immutable-js/pull/1887) by [marianoguerra](https://github.com/marianoguerra)
15-
1613
### Improve TypeScript definition for `Map`
1714

1815
Imagine the following code
@@ -82,6 +79,13 @@ Map<{ a?: string }>({ a: 'a' }).delete('a'); // you can only delete an optional
8279

8380
For now, only `get`, `getIn`, `set`, `update`, `delete` and `remove` methods are implemented. All other methods will fallback to the basic `Map` 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.
8481

82+
## [4.1.0] - 2022-05-23
83+
84+
- Accept Symbol as Map key. [#1859](https://github.com/immutable-js/immutable-js/pull/1859) by [jdeniau](https://github.com/jdeniau)
85+
- Optimize contructors without arguments [#1887](https://github.com/immutable-js/immutable-js/pull/1887) by [marianoguerra](https://github.com/marianoguerra)
86+
- Fix Flow removeIn types [#1902](https://github.com/immutable-js/immutable-js/pull/1902) by [nifgraup](https://github.com/nifgraup)
87+
- Fix bug in Record.equals when comparing against Map [#1903](https://github.com/immutable-js/immutable-js/pull/1903) by [jmtoung](https://github.com/jmtoung)
88+
8589
## [4.0.0] - 2021-09-30
8690

8791
This release brings new functionality and many fixes.

__tests__/Map.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,12 @@ describe('Map', () => {
428428
expect(is(m1, m2)).toBe(true);
429429
});
430430

431+
it('does not equal Record with same values', () => {
432+
const m1 = Map({ A: 1, B: 2, C: 3 });
433+
const m2 = Record({ A: 1, B: 2, C: 3 });
434+
expect(is(m1, m2)).toBe(false);
435+
});
436+
431437
it('deletes all the provided keys', () => {
432438
const NOT_SET = undefined;
433439
const m1 = Map({ A: 1, B: 2, C: 3 });

__tests__/Record.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ describe('Record', () => {
8888
expect(t1.equals(null)).toBeFalsy();
8989
});
9090

91+
it('if compared against Map should return false', () => {
92+
const MyType = Record({ a: 1, b: 2 });
93+
const t1 = MyType();
94+
expect(t1.equals(Map({ a: 1, b: 2 }))).toBeFalsy();
95+
});
96+
9197
it('merges in Objects and other Records', () => {
9298
const Point2 = Record({ x: 0, y: 0 });
9399
const Point3 = Record({ x: 0, y: 0, z: 0 });

package-lock.json

Lines changed: 46 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "immutable",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"description": "Immutable Data Collections",
55
"license": "MIT",
66
"homepage": "https://immutable-js.com",

src/Record.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ export class Record {
120120

121121
equals(other) {
122122
return (
123-
this === other || (other && recordSeq(this).equals(recordSeq(other)))
123+
this === other ||
124+
(isRecord(other) && recordSeq(this).equals(recordSeq(other)))
124125
);
125126
}
126127

type-definitions/immutable.js.flow

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,36 +1999,36 @@ declare function hasIn(collection: Object, keyPath: Iterable<mixed>): boolean;
19991999

20002000
declare function removeIn<C>(collection: C, keyPath: []): void;
20012001
declare function removeIn<C, K: $KeyOf<C>>(collection: C, keyPath: [K]): C;
2002-
declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C>>>(
2002+
declare function removeIn<C, K: $KeyOf<C>, K2: $KeyOf<$ValOf<C, K>>>(
20032003
collection: C,
20042004
keyPath: [K, K2]
20052005
): C;
20062006
declare function removeIn<
20072007
C,
20082008
K: $KeyOf<C>,
2009-
K2: $KeyOf<$ValOf<C>>,
2010-
K3: $KeyOf<$ValOf<$ValOf<C>, K2>>
2009+
K2: $KeyOf<$ValOf<C, K>>,
2010+
K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>
20112011
>(
20122012
collection: C,
20132013
keyPath: [K, K2, K3]
20142014
): C;
20152015
declare function removeIn<
20162016
C,
20172017
K: $KeyOf<C>,
2018-
K2: $KeyOf<$ValOf<C>>,
2019-
K3: $KeyOf<$ValOf<$ValOf<C>, K2>>,
2020-
K4: $KeyOf<$ValOf<$ValOf<$ValOf<C>, K2>, K3>>
2018+
K2: $KeyOf<$ValOf<C, K>>,
2019+
K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2020+
K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>
20212021
>(
20222022
collection: C,
20232023
keyPath: [K, K2, K3, K4]
20242024
): C;
20252025
declare function removeIn<
20262026
C,
20272027
K: $KeyOf<C>,
2028-
K2: $KeyOf<$ValOf<C>>,
2029-
K3: $KeyOf<$ValOf<$ValOf<C>, K2>>,
2030-
K4: $KeyOf<$ValOf<$ValOf<$ValOf<C>, K2>, K3>>,
2031-
K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C>, K2>, K3>, K4>>
2028+
K2: $KeyOf<$ValOf<C, K>>,
2029+
K3: $KeyOf<$ValOf<$ValOf<C, K>, K2>>,
2030+
K4: $KeyOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>>,
2031+
K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf<C, K>, K2>, K3>, K4>>
20322032
>(
20332033
collection: C,
20342034
keyPath: [K, K2, K3, K4, K5]

website/src/MarkdownContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const MarkdownContent = memo<Props>(function MarkdownContent({
2323

2424
return (
2525
<div
26-
className={'markdown ' + className}
26+
className={'markdown ' + (className || '')}
2727
onClick={handleClick}
2828
dangerouslySetInnerHTML={{ __html: contents }}
2929
/>

website/src/MemberDoc.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function MemberDoc({ member }: { member: MemberDefinition }) {
7070
{member.doc?.description && (
7171
<section>
7272
<h4 className="infoHeader">
73-
{member.doc.description.substr(0, 5) === '<code'
73+
{member.doc.description.slice(0, 5) === '<code'
7474
? 'Example'
7575
: 'Discussion'}
7676
</h4>

website/src/TypeDocumentation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function FunctionDoc({ def }: { def: MemberDefinition }) {
9494
{def.doc?.description && (
9595
<section>
9696
<h4 className="infoHeader">
97-
{def.doc.description.substr(0, 5) === '<code'
97+
{def.doc.description.slice(0, 5) === '<code'
9898
? 'Example'
9999
: 'Discussion'}
100100
</h4>
@@ -147,7 +147,7 @@ function TypeDoc({
147147
{def.doc?.description && (
148148
<section>
149149
<h4 className="infoHeader">
150-
{def.doc.description.substr(0, 5) === '<code'
150+
{def.doc.description.slice(0, 5) === '<code'
151151
? 'Example'
152152
: 'Discussion'}
153153
</h4>

0 commit comments

Comments
 (0)