You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 23, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ This made `Map` really unusable with TypeScript.
27
27
Now the Map is typed like this:
28
28
29
29
```ts
30
-
MapFromObject<{
30
+
MapOf<{
31
31
length:number;
32
32
1:string;
33
33
}>
@@ -38,6 +38,7 @@ and the return type of `m.get('length')` is typed as `number`.
38
38
The return of `m.get('inexistant')` throw the TypeScript error:
39
39
40
40
> Argument of type '"inexistant"' is not assignable to parameter of type '1 | "length"
41
+
41
42
#### If you want to keep the old definition
42
43
43
44
**This is a minor BC for TS users**, so if you want to keep the old definition, you can declare you Map like this:
@@ -59,7 +60,7 @@ type MyMapType = {
59
60
const m =Map<MyMapType>({ length: 3, 1: 'one' });
60
61
```
61
62
62
-
Keep in mind that the `MapFromObject` will try to be consistant with the simple TypeScript object, so you can not do this:
63
+
Keep in mind that the `MapOf` will try to be consistant with the simple TypeScript object, so you can not do this:
63
64
64
65
```ts
65
66
Map({ a: 'a' }).set('b', 'b');
@@ -77,8 +78,6 @@ Map<{ a?: string }>({ a: 'a' }).delete('a'); // you can only delete an optional
77
78
78
79
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.
79
80
80
-
81
-
82
81
## [4.2.4] - 2023-02-06
83
82
84
83
- Improve type infererence for from JS by [KSXGitHub](https://github.com/KSXGitHub)[#1927](https://github.com/immutable-js/immutable-js/pull/1927)
0 commit comments