Skip to content

Commit f367db0

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

File tree

35 files changed

+57
-57
lines changed

35 files changed

+57
-57
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.resi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ 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`. */
121+
/** `object_(dict)` makes a JSON object of the `dict`. */
122122
external object_: Js_dict.t<t> => t = "%identity"
123123

124124
/** `array_(a)` makes a JSON array of the `Js.Json.t` array `a`. */
@@ -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

tests/syntax_tests/data/idempotency/bs-css/CssEmotion.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include Css_Legacy_Core.Make({
1414
external injectRaw: (. string) => unit = "injectGlobal"
1515

1616
@module("emotion")
17-
external makeKeyFrames: (. Js.Dict.t<Js.Json.t>) => string = "keyframes"
17+
external makeKeyFrames: (. dict<Js.Json.t>) => string = "keyframes"
1818
})
1919

2020
type cache

0 commit comments

Comments
 (0)