Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce33aec

Browse files
authored
Explain in docs that keys get coerced to String when convering to Object. (#1134)
Fixes #1132
1 parent e8b5ad9 commit ce33aec

File tree

3 files changed

+48
-12
lines changed

3 files changed

+48
-12
lines changed

dist/immutable-nonambient.d.ts

+16-4
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@
18831883
toJSON(): T;
18841884

18851885
/**
1886-
* Shallowly converts this Record to equivalent JS.
1886+
* Shallowly converts this Record to equivalent JavaScript Object.
18871887
*/
18881888
toObject(): T;
18891889

@@ -1994,11 +1994,15 @@
19941994
export interface Keyed<K, V> extends Seq<K, V>, Iterable.Keyed<K, V> {
19951995
/**
19961996
* Deeply converts this Keyed Seq to equivalent native JavaScript Object.
1997+
*
1998+
* Converts keys to Strings.
19971999
*/
19982000
toJS(): Object;
19992001

20002002
/**
20012003
* Shallowly converts this Keyed Seq to equivalent native JavaScript Object.
2004+
*
2005+
* Converts keys to Strings.
20022006
*/
20032007
toJSON(): { [key: string]: V };
20042008

@@ -2322,11 +2326,15 @@
23222326
export interface Keyed<K, V> extends Iterable<K, V> {
23232327
/**
23242328
* Deeply converts this Keyed collection to equivalent native JavaScript Object.
2329+
*
2330+
* Converts keys to Strings.
23252331
*/
23262332
toJS(): Object;
23272333

23282334
/**
23292335
* Shallowly converts this Keyed collection to equivalent native JavaScript Object.
2336+
*
2337+
* Converts keys to Strings.
23302338
*/
23312339
toJSON(): { [key: string]: V };
23322340

@@ -2817,15 +2825,15 @@
28172825
* Deeply converts this Iterable to equivalent native JavaScript Array or Object.
28182826
*
28192827
* `Iterable.Indexed`, and `Iterable.Set` become `Array`, while
2820-
* `Iterable.Keyed` become `Object`.
2828+
* `Iterable.Keyed` become `Object`, converting keys to Strings.
28212829
*/
28222830
toJS(): Array<any> | { [key: string]: any };
28232831

28242832
/**
28252833
* Shallowly converts this Iterable to equivalent native JavaScript Array or Object.
28262834
*
28272835
* `Iterable.Indexed`, and `Iterable.Set` become `Array`, while
2828-
* `Iterable.Keyed` become `Object`.
2836+
* `Iterable.Keyed` become `Object`, converting keys to Strings.
28292837
*/
28302838
toJSON(): Array<V> | { [key: string]: V };
28312839

@@ -2837,7 +2845,7 @@
28372845
/**
28382846
* Shallowly converts this Iterable to an Object.
28392847
*
2840-
* Throws if keys are not strings.
2848+
* Converts keys to Strings.
28412849
*/
28422850
toObject(): { [key: string]: V };
28432851

@@ -3525,11 +3533,15 @@
35253533
export interface Keyed<K, V> extends Collection<K, V>, Iterable.Keyed<K, V> {
35263534
/**
35273535
* Deeply converts this Keyed Collection to equivalent native JavaScript Object.
3536+
*
3537+
* Converts keys to Strings.
35283538
*/
35293539
toJS(): Object;
35303540

35313541
/**
35323542
* Shallowly converts this Keyed Collection to equivalent native JavaScript Object.
3543+
*
3544+
* Converts keys to Strings.
35333545
*/
35343546
toJSON(): { [key: string]: V };
35353547

dist/immutable.d.ts

+16-4
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ declare module Immutable {
18831883
toJSON(): T;
18841884

18851885
/**
1886-
* Shallowly converts this Record to equivalent JS.
1886+
* Shallowly converts this Record to equivalent JavaScript Object.
18871887
*/
18881888
toObject(): T;
18891889

@@ -1994,11 +1994,15 @@ declare module Immutable {
19941994
export interface Keyed<K, V> extends Seq<K, V>, Iterable.Keyed<K, V> {
19951995
/**
19961996
* Deeply converts this Keyed Seq to equivalent native JavaScript Object.
1997+
*
1998+
* Converts keys to Strings.
19971999
*/
19982000
toJS(): Object;
19992001

20002002
/**
20012003
* Shallowly converts this Keyed Seq to equivalent native JavaScript Object.
2004+
*
2005+
* Converts keys to Strings.
20022006
*/
20032007
toJSON(): { [key: string]: V };
20042008

@@ -2322,11 +2326,15 @@ declare module Immutable {
23222326
export interface Keyed<K, V> extends Iterable<K, V> {
23232327
/**
23242328
* Deeply converts this Keyed collection to equivalent native JavaScript Object.
2329+
*
2330+
* Converts keys to Strings.
23252331
*/
23262332
toJS(): Object;
23272333

23282334
/**
23292335
* Shallowly converts this Keyed collection to equivalent native JavaScript Object.
2336+
*
2337+
* Converts keys to Strings.
23302338
*/
23312339
toJSON(): { [key: string]: V };
23322340

@@ -2817,15 +2825,15 @@ declare module Immutable {
28172825
* Deeply converts this Iterable to equivalent native JavaScript Array or Object.
28182826
*
28192827
* `Iterable.Indexed`, and `Iterable.Set` become `Array`, while
2820-
* `Iterable.Keyed` become `Object`.
2828+
* `Iterable.Keyed` become `Object`, converting keys to Strings.
28212829
*/
28222830
toJS(): Array<any> | { [key: string]: any };
28232831

28242832
/**
28252833
* Shallowly converts this Iterable to equivalent native JavaScript Array or Object.
28262834
*
28272835
* `Iterable.Indexed`, and `Iterable.Set` become `Array`, while
2828-
* `Iterable.Keyed` become `Object`.
2836+
* `Iterable.Keyed` become `Object`, converting keys to Strings.
28292837
*/
28302838
toJSON(): Array<V> | { [key: string]: V };
28312839

@@ -2837,7 +2845,7 @@ declare module Immutable {
28372845
/**
28382846
* Shallowly converts this Iterable to an Object.
28392847
*
2840-
* Throws if keys are not strings.
2848+
* Converts keys to Strings.
28412849
*/
28422850
toObject(): { [key: string]: V };
28432851

@@ -3525,11 +3533,15 @@ declare module Immutable {
35253533
export interface Keyed<K, V> extends Collection<K, V>, Iterable.Keyed<K, V> {
35263534
/**
35273535
* Deeply converts this Keyed Collection to equivalent native JavaScript Object.
3536+
*
3537+
* Converts keys to Strings.
35283538
*/
35293539
toJS(): Object;
35303540

35313541
/**
35323542
* Shallowly converts this Keyed Collection to equivalent native JavaScript Object.
3543+
*
3544+
* Converts keys to Strings.
35333545
*/
35343546
toJSON(): { [key: string]: V };
35353547

type-definitions/Immutable.d.ts

+16-4
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ declare module Immutable {
18831883
toJSON(): T;
18841884

18851885
/**
1886-
* Shallowly converts this Record to equivalent JS.
1886+
* Shallowly converts this Record to equivalent JavaScript Object.
18871887
*/
18881888
toObject(): T;
18891889

@@ -1994,11 +1994,15 @@ declare module Immutable {
19941994
export interface Keyed<K, V> extends Seq<K, V>, Iterable.Keyed<K, V> {
19951995
/**
19961996
* Deeply converts this Keyed Seq to equivalent native JavaScript Object.
1997+
*
1998+
* Converts keys to Strings.
19971999
*/
19982000
toJS(): Object;
19992001

20002002
/**
20012003
* Shallowly converts this Keyed Seq to equivalent native JavaScript Object.
2004+
*
2005+
* Converts keys to Strings.
20022006
*/
20032007
toJSON(): { [key: string]: V };
20042008

@@ -2322,11 +2326,15 @@ declare module Immutable {
23222326
export interface Keyed<K, V> extends Iterable<K, V> {
23232327
/**
23242328
* Deeply converts this Keyed collection to equivalent native JavaScript Object.
2329+
*
2330+
* Converts keys to Strings.
23252331
*/
23262332
toJS(): Object;
23272333

23282334
/**
23292335
* Shallowly converts this Keyed collection to equivalent native JavaScript Object.
2336+
*
2337+
* Converts keys to Strings.
23302338
*/
23312339
toJSON(): { [key: string]: V };
23322340

@@ -2817,15 +2825,15 @@ declare module Immutable {
28172825
* Deeply converts this Iterable to equivalent native JavaScript Array or Object.
28182826
*
28192827
* `Iterable.Indexed`, and `Iterable.Set` become `Array`, while
2820-
* `Iterable.Keyed` become `Object`.
2828+
* `Iterable.Keyed` become `Object`, converting keys to Strings.
28212829
*/
28222830
toJS(): Array<any> | { [key: string]: any };
28232831

28242832
/**
28252833
* Shallowly converts this Iterable to equivalent native JavaScript Array or Object.
28262834
*
28272835
* `Iterable.Indexed`, and `Iterable.Set` become `Array`, while
2828-
* `Iterable.Keyed` become `Object`.
2836+
* `Iterable.Keyed` become `Object`, converting keys to Strings.
28292837
*/
28302838
toJSON(): Array<V> | { [key: string]: V };
28312839

@@ -2837,7 +2845,7 @@ declare module Immutable {
28372845
/**
28382846
* Shallowly converts this Iterable to an Object.
28392847
*
2840-
* Throws if keys are not strings.
2848+
* Converts keys to Strings.
28412849
*/
28422850
toObject(): { [key: string]: V };
28432851

@@ -3525,11 +3533,15 @@ declare module Immutable {
35253533
export interface Keyed<K, V> extends Collection<K, V>, Iterable.Keyed<K, V> {
35263534
/**
35273535
* Deeply converts this Keyed Collection to equivalent native JavaScript Object.
3536+
*
3537+
* Converts keys to Strings.
35283538
*/
35293539
toJS(): Object;
35303540

35313541
/**
35323542
* Shallowly converts this Keyed Collection to equivalent native JavaScript Object.
3543+
*
3544+
* Converts keys to Strings.
35333545
*/
35343546
toJSON(): { [key: string]: V };
35353547

0 commit comments

Comments
 (0)