@@ -6,7 +6,7 @@ Compiles to a regular JavaScript object.*/
66/**
77Type representing a dictionary of value `'a`.
88*/
9- type t <'a > = Js . Dict . t <'a >
9+ type t <'a > = dict <'a >
1010
1111/**
1212`getUnsafe(dict, key)` Returns the `value` at the provided `key`.
@@ -23,7 +23,7 @@ Console.log(value) // value1
2323```
2424*/
2525@get_index
26- external getUnsafe : (t <'a >, string ) => 'a = ""
26+ external getUnsafe : (dict <'a >, string ) => 'a = ""
2727
2828/**
2929Returns the value at the provided key, if it exists. Returns an option.
@@ -39,7 +39,7 @@ switch dict->Dict.get("someKey") {
3939```
4040*/
4141@get_index
42- external get : (t <'a >, string ) => option <'a > = ""
42+ external get : (dict <'a >, string ) => option <'a > = ""
4343
4444/**
4545`set(dictionary, key, value)` sets the value at the provided key to the provided value.
@@ -52,7 +52,7 @@ dict->Dict.set("someKey", "someValue")
5252```
5353*/
5454@set_index
55- external set : (t <'a >, string , 'a ) => unit = ""
55+ external set : (dict <'a >, string , 'a ) => unit = ""
5656
5757/**
5858`delete(dictionary, key)` deletes the value at `key`, if it exists.
@@ -64,21 +64,21 @@ let dict = Dict.fromArray([("someKey", "someValue")])
6464dict->Dict.delete("someKey")
6565```
6666*/
67- let delete : (t <'a >, string ) => unit
67+ let delete : (dict <'a >, string ) => unit
6868
6969/**
7070`make()` creates a new, empty dictionary.
7171
7272## Examples
7373```rescript
74- let dict1: Dict.t <int> = Dict.make() // You can annotate the type of the values of your dict yourself if you want
74+ let dict1: dict <int> = Dict.make() // You can annotate the type of the values of your dict yourself if you want
7575
7676let dict2 = Dict.make() // Or you can let ReScript infer it via usage.
7777dict2->Dict.set("someKey", 12)
7878```
7979*/
8080@obj
81- external make : unit => t <'a > = ""
81+ external make : unit => dict <'a > = ""
8282
8383/**
8484`fromArray(entries)` creates a new dictionary from the provided array of key/value pairs.
@@ -89,7 +89,7 @@ let dict = Dict.fromArray([("key1", "value1"), ("key2", "value2")])
8989```
9090*/
9191@val
92- external fromArray : array <(string , 'a )> => t <'a > = "Object.fromEntries"
92+ external fromArray : array <(string , 'a )> => dict <'a > = "Object.fromEntries"
9393
9494/**
9595`fromIterator(entries)` creates a new dictionary from the provided iterator of key/value pairs.
@@ -99,11 +99,11 @@ external fromArray: array<(string, 'a)> => t<'a> = "Object.fromEntries"
9999// Pretend we have an iterator of the correct shape
100100@val external someIterator: Iterator.t<(string, int)> = "someIterator"
101101
102- let dict = Dict.fromIterator(someIterator) // Dict.t <int>
102+ let dict = Dict.fromIterator(someIterator) // dict <int>
103103```
104104*/
105105@val
106- external fromIterator : Iterator .t <(string , 'a )> => t <'a > = "Object.fromEntries"
106+ external fromIterator : Iterator .t <(string , 'a )> => dict <'a > = "Object.fromEntries"
107107
108108/**
109109`toArray(dictionary)` returns an array of all the key/value pairs of the dictionary.
@@ -118,7 +118,7 @@ Console.log(asArray) // Logs `[["someKey", 1], ["someKey2", 2]]` to the console
118118```
119119*/
120120@val
121- external toArray : t <'a > => array <(string , 'a )> = "Object.entries"
121+ external toArray : dict <'a > => array <(string , 'a )> = "Object.entries"
122122
123123/**
124124`keysToArray(dictionary)` returns an array of all the keys of the dictionary.
@@ -133,7 +133,7 @@ Console.log(keys) // Logs `["someKey", "someKey2"]` to the console
133133```
134134*/
135135@val
136- external keysToArray : t <'a > => array <string > = "Object.keys"
136+ external keysToArray : dict <'a > => array <string > = "Object.keys"
137137
138138/**
139139`valuesToArray(dictionary)` returns an array of all the values of the dictionary.
@@ -148,7 +148,7 @@ Console.log(values) // Logs `[1, 2]` to the console
148148```
149149*/
150150@val
151- external valuesToArray : t <'a > => array <'a > = "Object.values"
151+ external valuesToArray : dict <'a > => array <'a > = "Object.values"
152152
153153/**
154154`assign(dictionary1, dictionary2)` [shallowly](https://developer.mozilla.org/en-US/docs/Glossary/Shallow_copy) merges dictionary2 into dictionary1, and returns dictionary1.
@@ -172,7 +172,7 @@ Console.log(dict1->Dict.keysToArray) // Logs `["firstKey", "someKey", "someKey2"
172172```
173173*/
174174@val
175- external assign : (t <'a >, t <'a >) => t <'a > = "Object.assign"
175+ external assign : (dict <'a >, dict <'a >) => dict <'a > = "Object.assign"
176176
177177/**
178178`copy(dictionary)` [shallowly copies](https://developer.mozilla.org/en-US/docs/Glossary/Shallow_copy) the provided dictionary to a new dictionary.
@@ -187,7 +187,7 @@ Console.log2(dict->Dict.keysToArray, dict2->Dict.keysToArray)
187187```
188188*/
189189@val
190- external copy : (@as (json ` {}` ) _ , t <'a >) => t <'a > = "Object.assign"
190+ external copy : (@as (json ` {}` ) _ , dict <'a >) => dict <'a > = "Object.assign"
191191
192192/**
193193`forEach(dictionary, f)` iterates through all values of the dict.
@@ -203,7 +203,7 @@ dict->Dict.forEach(value => {
203203})
204204```
205205*/
206- let forEach : (t <'a >, 'a => unit ) => unit
206+ let forEach : (dict <'a >, 'a => unit ) => unit
207207
208208/**
209209`forEachWithKey(dictionary, f)` iterates through all values of the dict, including the key for each value.
@@ -217,7 +217,7 @@ dict->Dict.forEachWithKey((value, key) => {
217217})
218218```
219219*/
220- let forEachWithKey : (t <'a >, ('a , string ) => unit ) => unit
220+ let forEachWithKey : (dict <'a >, ('a , string ) => unit ) => unit
221221
222222/**
223223`mapValues(dictionary, f)` returns a new dictionary with the same keys, and `f` applied to each value in the original dictionary.
@@ -231,4 +231,4 @@ dict->Dict.mapValues(v => v + 10)->Dict.toArray // [("key1", 11), ("key2", 12)]
231231dict->Dict.mapValues(v => Int.toString(v))->Dict.toArray // [("key1", "1"), ("key2", "2")]
232232```
233233*/
234- let mapValues : (t <'a >, 'a => 'b ) => t <'b >
234+ let mapValues : (dict <'a >, 'a => 'b ) => dict <'b >
0 commit comments