Skip to content

Commit 2b541ee

Browse files
committed
(Js.)Dict.t -> dict
1 parent 3b93359 commit 2b541ee

File tree

36 files changed

+69
-69
lines changed

36 files changed

+69
-69
lines changed

runtime/Dict.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type t<'a> = Js.Dict.t<'a>
1+
type t<'a> = dict<'a>
22

33
@get_index external getUnsafe: (t<'a>, string) => 'a = ""
44
@get_index external get: (t<'a>, string) => option<'a> = ""

runtime/Dict.resi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Compiles to a regular JavaScript object.*/
66
/**
77
Type 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`.
@@ -71,7 +71,7 @@ let delete: (t<'a>, string) => unit
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
7676
let dict2 = Dict.make() // Or you can let ReScript infer it via usage.
7777
dict2->Dict.set("someKey", 12)
@@ -99,7 +99,7 @@ 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

runtime/JSON.res

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type rec t = Js.Json.t =
44
| @as(null) Null
55
| String(string)
66
| Number(float)
7-
| Object(Dict.t<t>)
7+
| Object(dict<t>)
88
| Array(array<t>)
99

1010
@unboxed
@@ -47,15 +47,15 @@ module Classify = {
4747
| Null
4848
| String(string)
4949
| Number(float)
50-
| Object(Dict.t<t>)
50+
| Object(dict<t>)
5151
| Array(array<t>)
5252

5353
@val external _internalClass: 'a => string = "Object.prototype.toString.call"
5454
external _asBool: 'a => bool = "%identity"
5555
external _asString: 'a => string = "%identity"
5656
external _asFloat: 'a => float = "%identity"
5757
external _asArray: 'a => array<Js.Json.t> = "%identity"
58-
external _asDict: 'a => Dict.t<Js.Json.t> = "%identity"
58+
external _asDict: 'a => dict<Js.Json.t> = "%identity"
5959

6060
let classify = value => {
6161
switch _internalClass(value) {
@@ -75,7 +75,7 @@ module Encode = {
7575
external string: string => t = "%identity"
7676
external int: int => t = "%identity"
7777
external float: float => t = "%identity"
78-
external object: Dict.t<t> => t = "%identity"
78+
external object: dict<t> => t = "%identity"
7979
external array: array<t> => t = "%identity"
8080
}
8181

@@ -86,7 +86,7 @@ module Decode = {
8686
let float = (json: t) => Type.typeof(json) === #number ? Some((Obj.magic(json): float)) : None
8787
let object = (json: t) =>
8888
if Type.typeof(json) === #object && !Array.isArray(json) && !(Obj.magic(json) === Null.null) {
89-
Some((Obj.magic(json): Dict.t<t>))
89+
Some((Obj.magic(json): dict<t>))
9090
} else {
9191
None
9292
}

runtime/JSON.resi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type rec t = Js.Json.t =
1111
| @as(null) Null
1212
| String(string)
1313
| Number(float)
14-
| Object(Dict.t<t>)
14+
| Object(dict<t>)
1515
| Array(array<t>)
1616

1717
@unboxed
@@ -578,7 +578,7 @@ module Classify: {
578578
| Null
579579
| String(string)
580580
| Number(float)
581-
| Object(Dict.t<t>)
581+
| Object(dict<t>)
582582
| Array(array<t>)
583583

584584
/**
@@ -660,7 +660,7 @@ module Encode: {
660660
JSON.Encode.object(dict)
661661
```
662662
*/
663-
external object: Dict.t<t> => t = "%identity"
663+
external object: dict<t> => t = "%identity"
664664

665665
/**
666666
Returns an array as a JSON object.
@@ -733,7 +733,7 @@ module Decode: {
733733
let float: t => option<float>
734734

735735
/**
736-
Decodes a single JSON value. If the value is an object, it will return `Some(Dict.t)` - otherwise it will return `None`.
736+
Decodes a single JSON value. If the value is an object, it will return `Some(dict)` - otherwise it will return `None`.
737737
738738
## Examples
739739
```rescript
@@ -744,7 +744,7 @@ module Decode: {
744744
// None
745745
```
746746
*/
747-
let object: t => option<Dict.t<t>>
747+
let object: t => option<dict<t>>
748748

749749
/**
750750
Decodes a single JSON value. If the value is an array, it will return `Some(array)` - otherwise it will return `None`.

runtime/Js_json.res

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ type rec t =
3030
| @as(null) Null
3131
| String(string)
3232
| Number(float)
33-
| Object(Js_dict.t<t>)
33+
| Object(dict<t>)
3434
| Array(array<t>)
3535

3636
module Kind = {
3737
type json = t
3838
type rec t<_> =
3939
| String: t<Js_string.t>
4040
| Number: t<float>
41-
| Object: t<Js_dict.t<json>>
41+
| Object: t<dict<json>>
4242
| Array: t<array<json>>
4343
| Boolean: t<bool>
4444
| Null: t<Js_types.null_val>
@@ -50,7 +50,7 @@ type tagged_t =
5050
| JSONNull
5151
| JSONString(string)
5252
| JSONNumber(float)
53-
| JSONObject(Js_dict.t<t>)
53+
| JSONObject(dict<t>)
5454
| JSONArray(array<t>)
5555

5656
let classify = (x: t): tagged_t => {
@@ -105,7 +105,7 @@ let decodeObject = json =>
105105
(!Js_array2.isArray(json) &&
106106
!((Obj.magic(json): Js_null.t<'a>) === Js_extern.null))
107107
) {
108-
Some((Obj.magic((json: t)): Js_dict.t<t>))
108+
Some((Obj.magic((json: t)): dict<t>))
109109
} else {
110110
None
111111
}
@@ -143,15 +143,15 @@ let decodeNull = (json): option<Js_null.t<_>> =>
143143
external string: string => t = "%identity"
144144
external number: float => t = "%identity"
145145
external boolean: bool => t = "%identity"
146-
external object_: Js_dict.t<t> => t = "%identity"
146+
external object_: dict<t> => t = "%identity"
147147

148148
/* external array_ : t array -> t = "%identity" */
149149

150150
external array: array<t> => t = "%identity"
151151
external stringArray: array<string> => t = "%identity"
152152
external numberArray: array<float> => t = "%identity"
153153
external booleanArray: array<bool> => t = "%identity"
154-
external objectArray: array<Js_dict.t<t>> => t = "%identity"
154+
external objectArray: array<dict<t>> => t = "%identity"
155155
@val @scope("JSON") external stringify: t => string = "stringify"
156156
@val @scope("JSON") external stringifyWithSpace: (t, @as(json`null`) _, int) => string = "stringify"
157157

runtime/Js_json.resi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type rec t =
3636
| @as(null) Null
3737
| String(string)
3838
| Number(float)
39-
| Object(Js_dict.t<t>)
39+
| Object(dict<t>)
4040
| Array(array<t>)
4141

4242
module Kind: {
@@ -45,7 +45,7 @@ module Kind: {
4545
type rec t<_> =
4646
| String: t<Js_string.t>
4747
| Number: t<float>
48-
| Object: t<Js_dict.t<json>>
48+
| Object: t<dict<json>>
4949
| Array: t<array<json>>
5050
| Boolean: t<bool>
5151
| Null: t<Js_types.null_val>
@@ -57,7 +57,7 @@ type tagged_t =
5757
| JSONNull
5858
| JSONString(string)
5959
| JSONNumber(float)
60-
| JSONObject(Js_dict.t<t>)
60+
| JSONObject(dict<t>)
6161
| JSONArray(array<t>)
6262

6363
/* ## Accessors */
@@ -82,7 +82,7 @@ let decodeNumber: t => option<float>
8282
/**
8383
`decodeObject(json)` returns `Some(o)` if `json` is an `object`, `None` otherwise.
8484
*/
85-
let decodeObject: t => option<Js_dict.t<t>>
85+
let decodeObject: t => option<dict<t>>
8686

8787
/**
8888
`decodeArray(json)` returns `Some(a)` if `json` is an `array`, `None` otherwise.
@@ -118,8 +118,8 @@ external number: float => t = "%identity"
118118
/** `boolean(b)` makes a JSON boolean of the `bool` `b`. */
119119
external boolean: bool => t = "%identity"
120120

121-
/** `object_(dict)` makes a JSON object of the `Js.Dict.t` `dict`. */
122-
external object_: Js_dict.t<t> => t = "%identity"
121+
/** `object_(dict)` makes a JSON object of the `dict`. */
122+
external object_: dict<t> => t = "%identity"
123123

124124
/** `array_(a)` makes a JSON array of the `Js.Json.t` array `a`. */
125125
external array: array<t> => t = "%identity"
@@ -140,7 +140,7 @@ external numberArray: array<float> => t = "%identity"
140140
external booleanArray: array<bool> => t = "%identity"
141141

142142
/** `objectArray(a) makes a JSON array of the `JsDict.t` array `a`. */
143-
external objectArray: array<Js_dict.t<t>> => t = "%identity"
143+
external objectArray: array<dict<t>> => t = "%identity"
144144

145145
/* ## String conversion */
146146

@@ -178,7 +178,7 @@ let getIds = s => {
178178
179179
switch Js.Json.classify(json) {
180180
| Js.Json.JSONObject(value) =>
181-
/* In this branch, compiler infer value : Js.Json.t Js.Dict.t */
181+
/* In this branch, compiler infer value : Js.Json.t dict */
182182
switch Js.Dict.get(value, "ids") {
183183
| Some(ids) =>
184184
switch Js.Json.classify(ids) {

tests/gentype_tests/typescript-react-example/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/gentype_tests/typescript-react-example/src/Core.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ let undefined0 = (x: Js.undefined<int>) => x
1717
let undefined1 = (x: Undefined.t<int>) => x
1818

1919
@genType
20-
let dict0 = (x: Js.Dict.t<string>) => x
20+
let dict0 = (x: dict<string>) => x
2121

2222
@genType
23-
let dict1 = (x: Dict.t<string>) => x
23+
let dict1 = (x: dict<string>) => x
2424

2525
@genType
2626
let promise0 = (x: promise<string>) => x
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
type t<'a> = Js.Dict.t<'a>
1+
type t<'a> = dict<'a>

tests/gentype_tests/typescript-react-example/src/nested/Types.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type opaqueVariant =
6060
@gentype
6161
type genTypeMispelled = int
6262

63-
@genType type dictString = Js.Dict.t<string>
63+
@genType type dictString = dict<string>
6464

6565
@genType let jsonStringify = Js.Json.stringify
6666

0 commit comments

Comments
 (0)