@@ -127,7 +127,7 @@ declare namespace Immutable {
127
127
: T extends Collection . Keyed < infer KeyedKey , infer V >
128
128
? // convert KeyedCollection to DeepCopy plain JS object
129
129
{
130
- [ key in KeyedKey extends string | number | symbol
130
+ [ key in KeyedKey extends PropertyKey
131
131
? KeyedKey
132
132
: string ] : V extends object ? unknown : V ;
133
133
}
@@ -853,9 +853,7 @@ declare namespace Immutable {
853
853
* not altered.
854
854
*/
855
855
function Map < K , V > ( collection ?: Iterable < [ K , V ] > ) : Map < K , V > ;
856
- function Map < R extends { [ key in string | number | symbol ] : unknown } > (
857
- obj : R
858
- ) : MapOf < R > ;
856
+ function Map < R extends { [ key in PropertyKey ] : unknown } > ( obj : R ) : MapOf < R > ;
859
857
function Map < V > ( obj : { [ key : string ] : V } ) : Map < string , V > ;
860
858
function Map < K extends string | symbol , V > ( obj : { [ P in K ] ?: V } ) : Map < K , V > ;
861
859
@@ -864,7 +862,7 @@ declare namespace Immutable {
864
862
*
865
863
* @ignore
866
864
*/
867
- interface MapOf < R extends { [ key in string | number | symbol ] : unknown } >
865
+ interface MapOf < R extends { [ key in PropertyKey ] : unknown } >
868
866
extends Map < keyof R , R [ keyof R ] > {
869
867
/**
870
868
* Returns the value associated with the provided key, or notSetValue if
@@ -3155,14 +3153,14 @@ declare namespace Immutable {
3155
3153
*
3156
3154
* Converts keys to Strings.
3157
3155
*/
3158
- toJS ( ) : { [ key in string | number | symbol ] : DeepCopy < V > } ;
3156
+ toJS ( ) : { [ key in PropertyKey ] : DeepCopy < V > } ;
3159
3157
3160
3158
/**
3161
3159
* Shallowly converts this Keyed Seq to equivalent native JavaScript Object.
3162
3160
*
3163
3161
* Converts keys to Strings.
3164
3162
*/
3165
- toJSON ( ) : { [ key in string | number | symbol ] : V } ;
3163
+ toJSON ( ) : { [ key in PropertyKey ] : V } ;
3166
3164
3167
3165
/**
3168
3166
* Shallowly converts this collection to an Array.
@@ -3763,14 +3761,14 @@ declare namespace Immutable {
3763
3761
*
3764
3762
* Converts keys to Strings.
3765
3763
*/
3766
- toJS ( ) : { [ key in string | number | symbol ] : DeepCopy < V > } ;
3764
+ toJS ( ) : { [ key in PropertyKey ] : DeepCopy < V > } ;
3767
3765
3768
3766
/**
3769
3767
* Shallowly converts this Keyed collection to equivalent native JavaScript Object.
3770
3768
*
3771
3769
* Converts keys to Strings.
3772
3770
*/
3773
- toJSON ( ) : { [ key in string | number | symbol ] : V } ;
3771
+ toJSON ( ) : { [ key in PropertyKey ] : V } ;
3774
3772
3775
3773
/**
3776
3774
* Shallowly converts this collection to an Array.
@@ -4520,17 +4518,15 @@ declare namespace Immutable {
4520
4518
* `Collection.Indexed`, and `Collection.Set` become `Array`, while
4521
4519
* `Collection.Keyed` become `Object`, converting keys to Strings.
4522
4520
*/
4523
- toJS ( ) :
4524
- | Array < DeepCopy < V > >
4525
- | { [ key in string | number | symbol ] : DeepCopy < V > } ;
4521
+ toJS ( ) : Array < DeepCopy < V > > | { [ key in PropertyKey ] : DeepCopy < V > } ;
4526
4522
4527
4523
/**
4528
4524
* Shallowly converts this Collection to equivalent native JavaScript Array or Object.
4529
4525
*
4530
4526
* `Collection.Indexed`, and `Collection.Set` become `Array`, while
4531
4527
* `Collection.Keyed` become `Object`, converting keys to Strings.
4532
4528
*/
4533
- toJSON ( ) : Array < V > | { [ key in string | number | symbol ] : V } ;
4529
+ toJSON ( ) : Array < V > | { [ key in PropertyKey ] : V } ;
4534
4530
4535
4531
/**
4536
4532
* Shallowly converts this collection to an Array.
@@ -5749,9 +5745,12 @@ declare namespace Immutable {
5749
5745
key : K ,
5750
5746
notSetValue : unknown
5751
5747
) : C [ K ] ;
5752
- function get < V > ( collection : { [ key : string ] : V } , key : string ) : V | undefined ;
5748
+ function get < V > (
5749
+ collection : { [ key : PropertyKey ] : V } ,
5750
+ key : string
5751
+ ) : V | undefined ;
5753
5752
function get < V , NSV > (
5754
- collection : { [ key : string ] : V } ,
5753
+ collection : { [ key : PropertyKey ] : V } ,
5755
5754
key : string ,
5756
5755
notSetValue : NSV
5757
5756
) : V | NSV ;
@@ -5971,7 +5970,11 @@ declare namespace Immutable {
5971
5970
* hasIn({ x: { y: { z: 123 }}}, ['x', 'q', 'p']) // false
5972
5971
* ```
5973
5972
*/
5974
- function hasIn ( collection : unknown , keyPath : Iterable < unknown > ) : boolean ;
5973
+ function hasIn (
5974
+ collection : string | boolean | number ,
5975
+ keyPath : KeyPath < unknown >
5976
+ ) : never ;
5977
+ function hasIn < K > ( collection : unknown , keyPath : KeyPath < K > ) : boolean ;
5975
5978
5976
5979
/**
5977
5980
* Returns a copy of the collection with the value at the key path removed.
@@ -6025,17 +6028,83 @@ declare namespace Immutable {
6025
6028
* console.log(original) // { x: { y: { z: 123 }}}
6026
6029
* ```
6027
6030
*/
6028
- function updateIn < C > (
6031
+ function updateIn < K extends PropertyKey , V , C extends Collection < K , V > > (
6029
6032
collection : C ,
6030
- keyPath : Iterable < unknown > ,
6031
- updater : ( value : unknown ) => unknown
6033
+ keyPath : KeyPath < K > ,
6034
+ updater : (
6035
+ value : RetrievePath < C , Array < K > > | undefined
6036
+ ) => unknown | undefined
6032
6037
) : C ;
6033
- function updateIn < C > (
6038
+ function updateIn < K extends PropertyKey , V , C extends Collection < K , V > , NSV > (
6034
6039
collection : C ,
6035
- keyPath : Iterable < unknown > ,
6036
- notSetValue : unknown ,
6037
- updater : ( value : unknown ) => unknown
6040
+ keyPath : KeyPath < K > ,
6041
+ notSetValue : NSV ,
6042
+ updater : ( value : RetrievePath < C , Array < K > > | NSV ) => unknown
6043
+ ) : C ;
6044
+ function updateIn <
6045
+ TProps extends object ,
6046
+ C extends Record < TProps > ,
6047
+ K extends keyof TProps ,
6048
+ > (
6049
+ record : C ,
6050
+ keyPath : KeyPath < K > ,
6051
+ updater : ( value : RetrievePath < C , Array < K > > ) => unknown
6052
+ ) : C ;
6053
+ function updateIn <
6054
+ TProps extends object ,
6055
+ C extends Record < TProps > ,
6056
+ K extends keyof TProps ,
6057
+ NSV ,
6058
+ > (
6059
+ record : C ,
6060
+ keyPath : KeyPath < K > ,
6061
+ notSetValue : NSV ,
6062
+ updater : ( value : RetrievePath < C , Array < K > > | NSV ) => unknown
6038
6063
) : C ;
6064
+ function updateIn < K extends PropertyKey , V , C extends Array < V > > (
6065
+ collection : Array < V > ,
6066
+ keyPath : KeyPath < string | number > ,
6067
+ updater : (
6068
+ value : RetrievePath < C , Array < K > > | undefined
6069
+ ) => unknown | undefined
6070
+ ) : Array <
97AE
span>V > ;
6071
+ function updateIn < K extends PropertyKey , V , C extends Array < V > , NSV > (
6072
+ collection : Array < V > ,
6073
+ keyPath : KeyPath < K > ,
6074
+ notSetValue : NSV ,
6075
+ updater : ( value : RetrievePath < C , Array < K > > | NSV ) => unknown
6076
+ ) : Array < V > ;
6077
+ function updateIn < K extends PropertyKey , C > (
6078
+ object : C ,
6079
+ keyPath : KeyPath < K > ,
6080
+ updater : ( value : RetrievePath < C , Array < K > > ) => unknown
6081
+ ) : C ;
6082
+ function updateIn < K extends PropertyKey , C , NSV > (
6083
+ object : C ,
6084
+ keyPath : KeyPath < K > ,
6085
+ notSetValue : NSV ,
6086
+ updater : ( value : RetrievePath < C , Array < K > > | NSV ) => unknown
6087
+ ) : C ;
6088
+ function updateIn <
6089
+ K extends PropertyKey ,
6090
+ V ,
6091
+ C extends { [ key : PropertyKey ] : V } ,
6092
+ > (
6093
+ collection : C ,
6094
+ keyPath : KeyPath < K > ,
6095
+ updater : ( value : RetrievePath < C , Array < K > > ) => unknown
6096
+ ) : { [ key : PropertyKey ] : V } ;
6097
+ function updateIn <
6098
+ K extends PropertyKey ,
6099
+ V ,
6100
+ C extends { [ key : PropertyKey ] : V } ,
6101
+ NSV ,
6102
+ > (
6103
+ collection : C ,
6104
+ keyPath : KeyPath < K > ,
6105
+ notSetValue : NSV ,
6106
+ updater : ( value : RetrievePath < C , Array < K > > | NSV ) => unknown
6107
+ ) : { [ key : PropertyKey ] : V } ;
6039
6108
6040
6109
/**
6041
6110
* Returns a copy of the collection with the remaining collections merged in.
0 commit comments