diff --git a/runtime/Dict.res b/runtime/Dict.res index c56ecdc783..d6e1b79d4b 100644 --- a/runtime/Dict.res +++ b/runtime/Dict.res @@ -1,28 +1,26 @@ -type t<'a> = Js.Dict.t<'a> - -@get_index external getUnsafe: (t<'a>, string) => 'a = "" -@get_index external get: (t<'a>, string) => option<'a> = "" -@set_index external set: (t<'a>, string, 'a) => unit = "" +@get_index external getUnsafe: (dict<'a>, string) => 'a = "" +@get_index external get: (dict<'a>, string) => option<'a> = "" +@set_index external set: (dict<'a>, string, 'a) => unit = "" @val external delete: 'a => unit = "delete" let delete = (dict, string) => { delete(get(dict, string)) } -@obj external make: unit => t<'a> = "" +@obj external make: unit => dict<'a> = "" -@val external fromArray: array<(string, 'a)> => t<'a> = "Object.fromEntries" -@val external fromIterator: Iterator.t<(string, 'a)> => t<'a> = "Object.fromEntries" +@val external fromArray: array<(string, 'a)> => dict<'a> = "Object.fromEntries" +@val external fromIterator: Iterator.t<(string, 'a)> => dict<'a> = "Object.fromEntries" -@val external toArray: t<'a> => array<(string, 'a)> = "Object.entries" +@val external toArray: dict<'a> => array<(string, 'a)> = "Object.entries" -@val external keysToArray: t<'a> => array = "Object.keys" +@val external keysToArray: dict<'a> => array = "Object.keys" -@val external valuesToArray: t<'a> => array<'a> = "Object.values" +@val external valuesToArray: dict<'a> => array<'a> = "Object.values" -@val external assign: (t<'a>, t<'a>) => t<'a> = "Object.assign" +@val external assign: (dict<'a>, dict<'a>) => dict<'a> = "Object.assign" -@val external copy: (@as(json`{}`) _, t<'a>) => t<'a> = "Object.assign" +@val external copy: (@as(json`{}`) _, dict<'a>) => dict<'a> = "Object.assign" let forEach = (dict, f) => { dict->valuesToArray->Array.forEach(value => f(value)) diff --git a/runtime/Dict.resi b/runtime/Dict.resi index 2850a12d20..6acadd3d38 100644 --- a/runtime/Dict.resi +++ b/runtime/Dict.resi @@ -3,11 +3,6 @@ A mutable dictionary with string keys. Compiles to a regular JavaScript object.*/ -/** -Type representing a dictionary of value `'a`. -*/ -type t<'a> = Js.Dict.t<'a> - /** `getUnsafe(dict, key)` Returns the `value` at the provided `key`. @@ -23,7 +18,7 @@ Console.log(value) // value1 ``` */ @get_index -external getUnsafe: (t<'a>, string) => 'a = "" +external getUnsafe: (dict<'a>, string) => 'a = "" /** Returns the value at the provided key, if it exists. Returns an option. @@ -39,7 +34,7 @@ switch dict->Dict.get("someKey") { ``` */ @get_index -external get: (t<'a>, string) => option<'a> = "" +external get: (dict<'a>, string) => option<'a> = "" /** `set(dictionary, key, value)` sets the value at the provided key to the provided value. @@ -52,7 +47,7 @@ dict->Dict.set("someKey", "someValue") ``` */ @set_index -external set: (t<'a>, string, 'a) => unit = "" +external set: (dict<'a>, string, 'a) => unit = "" /** `delete(dictionary, key)` deletes the value at `key`, if it exists. @@ -64,21 +59,21 @@ let dict = Dict.fromArray([("someKey", "someValue")]) dict->Dict.delete("someKey") ``` */ -let delete: (t<'a>, string) => unit +let delete: (dict<'a>, string) => unit /** `make()` creates a new, empty dictionary. ## Examples ```rescript -let dict1: Dict.t = Dict.make() // You can annotate the type of the values of your dict yourself if you want +let dict1: dict = Dict.make() // You can annotate the type of the values of your dict yourself if you want let dict2 = Dict.make() // Or you can let ReScript infer it via usage. dict2->Dict.set("someKey", 12) ``` */ @obj -external make: unit => t<'a> = "" +external make: unit => dict<'a> = "" /** `fromArray(entries)` creates a new dictionary from the provided array of key/value pairs. @@ -89,7 +84,7 @@ let dict = Dict.fromArray([("key1", "value1"), ("key2", "value2")]) ``` */ @val -external fromArray: array<(string, 'a)> => t<'a> = "Object.fromEntries" +external fromArray: array<(string, 'a)> => dict<'a> = "Object.fromEntries" /** `fromIterator(entries)` creates a new dictionary from the provided iterator of key/value pairs. @@ -99,11 +94,11 @@ external fromArray: array<(string, 'a)> => t<'a> = "Object.fromEntries" // Pretend we have an iterator of the correct shape @val external someIterator: Iterator.t<(string, int)> = "someIterator" -let dict = Dict.fromIterator(someIterator) // Dict.t +let dict = Dict.fromIterator(someIterator) // dict ``` */ @val -external fromIterator: Iterator.t<(string, 'a)> => t<'a> = "Object.fromEntries" +external fromIterator: Iterator.t<(string, 'a)> => dict<'a> = "Object.fromEntries" /** `toArray(dictionary)` returns an array of all the key/value pairs of the dictionary. @@ -118,7 +113,7 @@ Console.log(asArray) // Logs `[["someKey", 1], ["someKey2", 2]]` to the console ``` */ @val -external toArray: t<'a> => array<(string, 'a)> = "Object.entries" +external toArray: dict<'a> => array<(string, 'a)> = "Object.entries" /** `keysToArray(dictionary)` returns an array of all the keys of the dictionary. @@ -133,7 +128,7 @@ Console.log(keys) // Logs `["someKey", "someKey2"]` to the console ``` */ @val -external keysToArray: t<'a> => array = "Object.keys" +external keysToArray: dict<'a> => array = "Object.keys" /** `valuesToArray(dictionary)` returns an array of all the values of the dictionary. @@ -148,7 +143,7 @@ Console.log(values) // Logs `[1, 2]` to the console ``` */ @val -external valuesToArray: t<'a> => array<'a> = "Object.values" +external valuesToArray: dict<'a> => array<'a> = "Object.values" /** `assign(dictionary1, dictionary2)` [shallowly](https://developer.mozilla.org/en-US/docs/Glossary/Shallow_copy) merges dictionary2 into dictionary1, and returns dictionary1. @@ -172,7 +167,7 @@ Console.log(dict1->Dict.keysToArray) // Logs `["firstKey", "someKey", "someKey2" ``` */ @val -external assign: (t<'a>, t<'a>) => t<'a> = "Object.assign" +external assign: (dict<'a>, dict<'a>) => dict<'a> = "Object.assign" /** `copy(dictionary)` [shallowly copies](https://developer.mozilla.org/en-US/docs/Glossary/Shallow_copy) the provided dictionary to a new dictionary. @@ -187,7 +182,7 @@ Console.log2(dict->Dict.keysToArray, dict2->Dict.keysToArray) ``` */ @val -external copy: (@as(json`{}`) _, t<'a>) => t<'a> = "Object.assign" +external copy: (@as(json`{}`) _, dict<'a>) => dict<'a> = "Object.assign" /** `forEach(dictionary, f)` iterates through all values of the dict. @@ -203,7 +198,7 @@ dict->Dict.forEach(value => { }) ``` */ -let forEach: (t<'a>, 'a => unit) => unit +let forEach: (dict<'a>, 'a => unit) => unit /** `forEachWithKey(dictionary, f)` iterates through all values of the dict, including the key for each value. @@ -217,7 +212,7 @@ dict->Dict.forEachWithKey((value, key) => { }) ``` */ -let forEachWithKey: (t<'a>, ('a, string) => unit) => unit +let forEachWithKey: (dict<'a>, ('a, string) => unit) => unit /** `mapValues(dictionary, f)` returns a new dictionary with the same keys, and `f` applied to each value in the original dictionary. @@ -231,4 +226,4 @@ dict->Dict.mapValues(v => v + 10)->Dict.toArray // [("key1", 11), ("key2", 12)] dict->Dict.mapValues(v => Int.toString(v))->Dict.toArray // [("key1", "1"), ("key2", "2")] ``` */ -let mapValues: (t<'a>, 'a => 'b) => t<'b> +let mapValues: (dict<'a>, 'a => 'b) => dict<'b> diff --git a/runtime/JSON.res b/runtime/JSON.res index b9ee231e8c..f31d94be14 100644 --- a/runtime/JSON.res +++ b/runtime/JSON.res @@ -4,7 +4,7 @@ type rec t = Js.Json.t = | @as(null) Null | String(string) | Number(float) - | Object(Dict.t) + | Object(dict) | Array(array) @unboxed @@ -47,7 +47,7 @@ module Classify = { | Null | String(string) | Number(float) - | Object(Dict.t) + | Object(dict) | Array(array) @val external _internalClass: 'a => string = "Object.prototype.toString.call" @@ -55,7 +55,7 @@ module Classify = { external _asString: 'a => string = "%identity" external _asFloat: 'a => float = "%identity" external _asArray: 'a => array = "%identity" - external _asDict: 'a => Dict.t = "%identity" + external _asDict: 'a => dict = "%identity" let classify = value => { switch _internalClass(value) { @@ -75,7 +75,7 @@ module Encode = { external string: string => t = "%identity" external int: int => t = "%identity" external float: float => t = "%identity" - external object: Dict.t => t = "%identity" + external object: dict => t = "%identity" external array: array => t = "%identity" } @@ -86,7 +86,7 @@ module Decode = { let float = (json: t) => Type.typeof(json) === #number ? Some((Obj.magic(json): float)) : None let object = (json: t) => if Type.typeof(json) === #object && !Array.isArray(json) && !(Obj.magic(json) === Null.null) { - Some((Obj.magic(json): Dict.t)) + Some((Obj.magic(json): dict)) } else { None } diff --git a/runtime/JSON.resi b/runtime/JSON.resi index eeccc56bad..02f8b8793f 100644 --- a/runtime/JSON.resi +++ b/runtime/JSON.resi @@ -11,7 +11,7 @@ type rec t = Js.Json.t = | @as(null) Null | String(string) | Number(float) - | Object(Dict.t) + | Object(dict) | Array(array) @unboxed @@ -578,7 +578,7 @@ module Classify: { | Null | String(string) | Number(float) - | Object(Dict.t) + | Object(dict) | Array(array) /** @@ -660,7 +660,7 @@ module Encode: { JSON.Encode.object(dict) ``` */ - external object: Dict.t => t = "%identity" + external object: dict => t = "%identity" /** Returns an array as a JSON object. @@ -733,7 +733,7 @@ module Decode: { let float: t => option /** - Decodes a single JSON value. If the value is an object, it will return `Some(Dict.t)` - otherwise it will return `None`. + Decodes a single JSON value. If the value is an object, it will return `Some(dict)` - otherwise it will return `None`. ## Examples ```rescript @@ -744,7 +744,7 @@ module Decode: { // None ``` */ - let object: t => option> + let object: t => option> /** Decodes a single JSON value. If the value is an array, it will return `Some(array)` - otherwise it will return `None`. diff --git a/runtime/Js_json.res b/runtime/Js_json.res index 7888b086df..f30a748c34 100644 --- a/runtime/Js_json.res +++ b/runtime/Js_json.res @@ -30,7 +30,7 @@ type rec t = | @as(null) Null | String(string) | Number(float) - | Object(Js_dict.t) + | Object(dict) | Array(array) module Kind = { @@ -38,7 +38,7 @@ module Kind = { type rec t<_> = | String: t | Number: t - | Object: t> + | Object: t> | Array: t> | Boolean: t | Null: t @@ -50,7 +50,7 @@ type tagged_t = | JSONNull | JSONString(string) | JSONNumber(float) - | JSONObject(Js_dict.t) + | JSONObject(dict) | JSONArray(array) let classify = (x: t): tagged_t => { @@ -105,7 +105,7 @@ let decodeObject = json => (!Js_array2.isArray(json) && !((Obj.magic(json): Js_null.t<'a>) === Js_extern.null)) ) { - Some((Obj.magic((json: t)): Js_dict.t)) + Some((Obj.magic((json: t)): dict)) } else { None } @@ -143,7 +143,7 @@ let decodeNull = (json): option> => external string: string => t = "%identity" external number: float => t = "%identity" external boolean: bool => t = "%identity" -external object_: Js_dict.t => t = "%identity" +external object_: dict => t = "%identity" /* external array_ : t array -> t = "%identity" */ @@ -151,7 +151,7 @@ external array: array => t = "%identity" external stringArray: array => t = "%identity" external numberArray: array => t = "%identity" external booleanArray: array => t = "%identity" -external objectArray: array> => t = "%identity" +external objectArray: array> => t = "%identity" @val @scope("JSON") external stringify: t => string = "stringify" @val @scope("JSON") external stringifyWithSpace: (t, @as(json`null`) _, int) => string = "stringify" diff --git a/runtime/Js_json.resi b/runtime/Js_json.resi index 0043b1cbdd..5686c916f3 100644 --- a/runtime/Js_json.resi +++ b/runtime/Js_json.resi @@ -36,7 +36,7 @@ type rec t = | @as(null) Null | String(string) | Number(float) - | Object(Js_dict.t) + | Object(dict) | Array(array) module Kind: { @@ -45,7 +45,7 @@ module Kind: { type rec t<_> = | String: t | Number: t - | Object: t> + | Object: t> | Array: t> | Boolean: t | Null: t @@ -57,7 +57,7 @@ type tagged_t = | JSONNull | JSONString(string) | JSONNumber(float) - | JSONObject(Js_dict.t) + | JSONObject(dict) | JSONArray(array) /* ## Accessors */ @@ -82,7 +82,7 @@ let decodeNumber: t => option /** `decodeObject(json)` returns `Some(o)` if `json` is an `object`, `None` otherwise. */ -let decodeObject: t => option> +let decodeObject: t => option> /** `decodeArray(json)` returns `Some(a)` if `json` is an `array`, `None` otherwise. @@ -118,8 +118,8 @@ external number: float => t = "%identity" /** `boolean(b)` makes a JSON boolean of the `bool` `b`. */ external boolean: bool => t = "%identity" -/** `object_(dict)` makes a JSON object of the `Js.Dict.t` `dict`. */ -external object_: Js_dict.t => t = "%identity" +/** `object_(dict)` makes a JSON object of the `dict`. */ +external object_: dict => t = "%identity" /** `array_(a)` makes a JSON array of the `Js.Json.t` array `a`. */ external array: array => t = "%identity" @@ -140,7 +140,7 @@ external numberArray: array => t = "%identity" external booleanArray: array => t = "%identity" /** `objectArray(a) makes a JSON array of the `JsDict.t` array `a`. */ -external objectArray: array> => t = "%identity" +external objectArray: array> => t = "%identity" /* ## String conversion */ @@ -178,7 +178,7 @@ let getIds = s => { switch Js.Json.classify(json) { | Js.Json.JSONObject(value) => - /* In this branch, compiler infer value : Js.Json.t Js.Dict.t */ + /* In this branch, compiler infer value : Js.Json.t dict */ switch Js.Dict.get(value, "ids") { | Some(ids) => switch Js.Json.classify(ids) { diff --git a/tests/gentype_tests/typescript-react-example/package-lock.json b/tests/gentype_tests/typescript-react-example/package-lock.json index 3d1726bcb8..090c2be357 100644 --- a/tests/gentype_tests/typescript-react-example/package-lock.json +++ b/tests/gentype_tests/typescript-react-example/package-lock.json @@ -22,7 +22,7 @@ }, "../../..": { "name": "rescript", - "version": "12.0.0-alpha.4", + "version": "12.0.0-alpha.5", "dev": true, "hasInstallScript": true, "license": "SEE LICENSE IN LICENSE", diff --git a/tests/gentype_tests/typescript-react-example/src/Core.res b/tests/gentype_tests/typescript-react-example/src/Core.res index 491d106c88..51a9ddcb90 100644 --- a/tests/gentype_tests/typescript-react-example/src/Core.res +++ b/tests/gentype_tests/typescript-react-example/src/Core.res @@ -17,10 +17,10 @@ let undefined0 = (x: Js.undefined) => x let undefined1 = (x: Undefined.t) => x @genType -let dict0 = (x: Js.Dict.t) => x +let dict0 = (x: dict) => x @genType -let dict1 = (x: Dict.t) => x +let dict1 = (x: dict) => x @genType let promise0 = (x: promise) => x diff --git a/tests/gentype_tests/typescript-react-example/src/Dict.res b/tests/gentype_tests/typescript-react-example/src/Dict.res index 444e46d661..1f55b2f8b4 100644 --- a/tests/gentype_tests/typescript-react-example/src/Dict.res +++ b/tests/gentype_tests/typescript-react-example/src/Dict.res @@ -1 +1 @@ -type t<'a> = Js.Dict.t<'a> +type t<'a> = dict<'a> diff --git a/tests/gentype_tests/typescript-react-example/src/nested/Types.res b/tests/gentype_tests/typescript-react-example/src/nested/Types.res index 54fa80803c..9e1658e248 100644 --- a/tests/gentype_tests/typescript-react-example/src/nested/Types.res +++ b/tests/gentype_tests/typescript-react-example/src/nested/Types.res @@ -60,7 +60,7 @@ type opaqueVariant = @gentype type genTypeMispelled = int -@genType type dictString = Js.Dict.t +@genType type dictString = dict @genType let jsonStringify = Js.Json.stringify diff --git a/tests/syntax_tests/data/idempotency/bs-css/CssEmotion.res b/tests/syntax_tests/data/idempotency/bs-css/CssEmotion.res index 97b2eed304..8370d2919e 100644 --- a/tests/syntax_tests/data/idempotency/bs-css/CssEmotion.res +++ b/tests/syntax_tests/data/idempotency/bs-css/CssEmotion.res @@ -14,7 +14,7 @@ include Css_Legacy_Core.Make({ external injectRaw: (. string) => unit = "injectGlobal" @module("emotion") - external makeKeyFrames: (. Js.Dict.t) => string = "keyframes" + external makeKeyFrames: (. dict) => string = "keyframes" }) type cache diff --git a/tests/syntax_tests/data/idempotency/bs-css/CssEmotionJs.res b/tests/syntax_tests/data/idempotency/bs-css/CssEmotionJs.res index 8e711f25f5..2a32d7095e 100644 --- a/tests/syntax_tests/data/idempotency/bs-css/CssEmotionJs.res +++ b/tests/syntax_tests/data/idempotency/bs-css/CssEmotionJs.res @@ -14,7 +14,7 @@ include Css_Js_Core.Make({ external injectRaw: (. string) => unit = "injectGlobal" @module("emotion") - external makeKeyFrames: (. Js.Dict.t) => string = "keyframes" + external makeKeyFrames: (. dict) => string = "keyframes" }) type cache diff --git a/tests/syntax_tests/data/idempotency/bs-css/Css_Core.res b/tests/syntax_tests/data/idempotency/bs-css/Css_Core.res index 11a23eceb6..6c9b577056 100644 --- a/tests/syntax_tests/data/idempotency/bs-css/Css_Core.res +++ b/tests/syntax_tests/data/idempotency/bs-css/Css_Core.res @@ -3,5 +3,5 @@ module type CssImplementationIntf = { let injectRule: (. Js.Json.t) => unit let injectRaw: (. string) => unit let make: (. Js.Json.t) => string - let makeKeyFrames: (. Js.Dict.t) => string + let makeKeyFrames: (. dict) => string } diff --git a/tests/syntax_tests/data/idempotency/bs-webapi/src/Webapi/Webapi__Url.res b/tests/syntax_tests/data/idempotency/bs-webapi/src/Webapi/Webapi__Url.res index 1af44c7a6c..9ce5ee9216 100644 --- a/tests/syntax_tests/data/idempotency/bs-webapi/src/Webapi/Webapi__Url.res +++ b/tests/syntax_tests/data/idempotency/bs-webapi/src/Webapi/Webapi__Url.res @@ -2,7 +2,7 @@ module URLSearchParams = { type t @new external make: string => t = "URLSearchParams" - @new external makeWithDict: Js.Dict.t => t = "URLSearchParams" + @new external makeWithDict: dict => t = "URLSearchParams" @new external makeWithArray: array<(string, string)> => t = "URLSearchParams" } diff --git a/tests/syntax_tests/data/idempotency/covid-19charts.com/src/Data.res b/tests/syntax_tests/data/idempotency/covid-19charts.com/src/Data.res index 4d0c1abac0..1711269c2a 100644 --- a/tests/syntax_tests/data/idempotency/covid-19charts.com/src/Data.res +++ b/tests/syntax_tests/data/idempotency/covid-19charts.com/src/Data.res @@ -10,7 +10,7 @@ module Map: { let set: (t<'key, 'value>, 'key, 'value) => unit let empty: unit => t<'key, 'value> } = { - type t<'key, 'value> = Js.Dict.t<'value> constraint 'key = string + type t<'key, 'value> = dict<'value> constraint 'key = string let keys = Js.Dict.keys let get = Js.Dict.unsafeGet let get_opt = Js.Dict.get diff --git a/tests/syntax_tests/data/idempotency/covid-19charts.com/src/SerializeQueryParam.res b/tests/syntax_tests/data/idempotency/covid-19charts.com/src/SerializeQueryParam.res index 368607047b..f12085be0a 100644 --- a/tests/syntax_tests/data/idempotency/covid-19charts.com/src/SerializeQueryParam.res +++ b/tests/syntax_tests/data/idempotency/covid-19charts.com/src/SerializeQueryParam.res @@ -24,8 +24,8 @@ type locationFragments = { } @module("serialize-query-params") -external updateInLocation: (Js.Dict.t>, Window.location) => locationFragments = +external updateInLocation: (dict>, Window.location) => locationFragments = "updateInLocation" @module("serialize-query-params") -external parse: string => Js.Dict.t = "parse" +external parse: string => dict = "parse" diff --git a/tests/syntax_tests/data/idempotency/nook-exchange/Item.res b/tests/syntax_tests/data/idempotency/nook-exchange/Item.res index dcf0826489..da96303879 100644 --- a/tests/syntax_tests/data/idempotency/nook-exchange/Item.res +++ b/tests/syntax_tests/data/idempotency/nook-exchange/Item.res @@ -243,7 +243,7 @@ let getCanonicalVariant = (~item, ~variant) => type variantNames = | NameOneDimension(array) | NameTwoDimensions((array, array)) -let variantNames: Js.Dict.t = variantsJson |> { +let variantNames: dict = variantsJson |> { open Json.Decode dict( oneOf(list{ @@ -261,8 +261,8 @@ type translationItem = { variants: option, } type translations = { - items: Js.Dict.t, - materials: Js.Dict.t, + items: dict, + materials: dict, } let translations: ref> = ref(None) let setTranslations = json => { diff --git a/tests/syntax_tests/data/idempotency/nook-exchange/User.res b/tests/syntax_tests/data/idempotency/nook-exchange/User.res index fa33238944..5ab6bfb2c2 100644 --- a/tests/syntax_tests/data/idempotency/nook-exchange/User.res +++ b/tests/syntax_tests/data/idempotency/nook-exchange/User.res @@ -72,7 +72,7 @@ type t = { id: string, username: string, email: option, - items: Js.Dict.t, + items: dict, profileText: string, enableCatalogCheckbox: bool, followeeIds: option>, diff --git a/tests/syntax_tests/data/idempotency/nook-exchange/Utils.res b/tests/syntax_tests/data/idempotency/nook-exchange/Utils.res index 9a001827b7..679cf60f21 100644 --- a/tests/syntax_tests/data/idempotency/nook-exchange/Utils.res +++ b/tests/syntax_tests/data/idempotency/nook-exchange/Utils.res @@ -1,8 +1,8 @@ @val @scope("Object") -external objectAssign: (Js.Dict.t<'a>, Js.Dict.t<'a>) => unit = "assign" +external objectAssign: (dict<'a>, dict<'a>) => unit = "assign" @val @scope("Object") @variadic -external objectAssignMany: array> => unit = "assign" +external objectAssignMany: array> => unit = "assign" let cloneJsDict = dict => { let clone = Js.Dict.empty() @@ -20,7 +20,7 @@ type any let _internalDeleteJsDictKey: (any, string) => unit = %raw( "function(dict, key) { delete dict[key]; }" ) -external convertToAny: Js.Dict.t<'a> => any = "%identity" +external convertToAny: dict<'a> => any = "%identity" let deleteJsDictKey = (dict, key) => _internalDeleteJsDictKey(convertToAny(dict), key) diff --git a/tests/syntax_tests/data/idempotency/reasonml.org/bindings/Next.res b/tests/syntax_tests/data/idempotency/reasonml.org/bindings/Next.res index caf5f45eb5..113bdabfe9 100644 --- a/tests/syntax_tests/data/idempotency/reasonml.org/bindings/Next.res +++ b/tests/syntax_tests/data/idempotency/reasonml.org/bindings/Next.res @@ -1,4 +1,4 @@ -type getInitialPropsFn<'a> = {"query": Js.Dict.t, "req": Js.Nullable.t<'a>} => Js.Promise.t< +type getInitialPropsFn<'a> = {"query": dict, "req": Js.Nullable.t<'a>} => Js.Promise.t< 'a, > diff --git a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/BeltDocsLayout.res b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/BeltDocsLayout.res index 0b5180591e..ec9033e0a8 100644 --- a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/BeltDocsLayout.res +++ b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/BeltDocsLayout.res @@ -1,7 +1,7 @@ module Link = Next.Link // Structure defined by `scripts/extract-indices.js` -let indexData: Js.Dict.t<{ +let indexData: dict<{ "moduleName": string, "headers": array<{ "name": string, diff --git a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/CommunityLayout.res b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/CommunityLayout.res index dbcc4fd5e9..cedc2c184e 100644 --- a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/CommunityLayout.res +++ b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/CommunityLayout.res @@ -1,7 +1,7 @@ module Link = Next.Link // Structure defined by `scripts/extract-tocs.js` -let tocData: Js.Dict.t<{ +let tocData: dict<{ "title": string, "headers": array<{ "name": string, diff --git a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/GenTypeDocsLayout.res b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/GenTypeDocsLayout.res index 484144aeed..99f5258a67 100644 --- a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/GenTypeDocsLayout.res +++ b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/GenTypeDocsLayout.res @@ -15,7 +15,7 @@ hljs.registerLanguage('json', jsonHighlightJs); module Link = Next.Link // Structure defined by `scripts/extract-tocs.js` -let tocData: Js.Dict.t<{ +let tocData: dict<{ "title": string, "headers": array<{ "name": string, diff --git a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/JsDocsLayout.res b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/JsDocsLayout.res index 33225d11b2..67b07b0ff9 100644 --- a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/JsDocsLayout.res +++ b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/JsDocsLayout.res @@ -1,7 +1,7 @@ module Link = Next.Link // Structure defined by `scripts/extract-indices.js` -let indexData: Js.Dict.t<{ +let indexData: dict<{ "moduleName": string, "headers": array<{ "name": string, diff --git a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ManualDocsLayout.res b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ManualDocsLayout.res index e321ad5256..f6a0897dcc 100644 --- a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ManualDocsLayout.res +++ b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ManualDocsLayout.res @@ -1,7 +1,7 @@ module Link = Next.Link // Structure defined by `scripts/extract-tocs.js` -let tocData: Js.Dict.t<{ +let tocData: dict<{ "title": string, "headers": array<{ "name": string, diff --git a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ReasonCompilerDocsLayout.res b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ReasonCompilerDocsLayout.res index 833a22424e..5a709d8ef9 100644 --- a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ReasonCompilerDocsLayout.res +++ b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ReasonCompilerDocsLayout.res @@ -1,7 +1,7 @@ module Link = Next.Link // Structure defined by `scripts/extract-tocs.js` -let tocData: Js.Dict.t<{ +let tocData: dict<{ "title": string, "headers": array<{ "name": string, diff --git a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ReasonReactDocsLayout.res b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ReasonReactDocsLayout.res index 7b97e34ca7..a9c78c2b4b 100644 --- a/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ReasonReactDocsLayout.res +++ b/tests/syntax_tests/data/idempotency/reasonml.org/layouts/ReasonReactDocsLayout.res @@ -1,7 +1,7 @@ module Link = Next.Link // Structure defined by `scripts/extract-tocs.js` -let tocData: Js.Dict.t<{ +let tocData: dict<{ "title": string, "headers": array<{ "name": string, diff --git a/tests/syntax_tests/data/idempotency/wildcards-world-ui/UserProvider.res b/tests/syntax_tests/data/idempotency/wildcards-world-ui/UserProvider.res index 57021e7491..8ec3d33081 100644 --- a/tests/syntax_tests/data/idempotency/wildcards-world-ui/UserProvider.res +++ b/tests/syntax_tests/data/idempotency/wildcards-world-ui/UserProvider.res @@ -6,7 +6,7 @@ open Globals type threeBoxImageData = { @as("@type") imageType: string, - contentUrl: Js.Dict.t, + contentUrl: dict, } type threeBoxImage = array type threeBoxTwitterVerification = { @@ -32,7 +32,7 @@ type threeBoxUserInfo = { type userVerification = {threeBox: threeBoxUserInfo} type userInfo = { - userInfo: Js.Dict.t, + userInfo: dict, update: (string, bool) => unit, } diff --git a/tests/syntax_tests/data/parsing/grammar/typexpr/es6Arrow.res b/tests/syntax_tests/data/parsing/grammar/typexpr/es6Arrow.res index 82cc49579e..fe9cf0b24a 100644 --- a/tests/syntax_tests/data/parsing/grammar/typexpr/es6Arrow.res +++ b/tests/syntax_tests/data/parsing/grammar/typexpr/es6Arrow.res @@ -40,7 +40,7 @@ type t = @attrBeforeLblA ((~a: int) => (@attrBeforeLblB ((~b: int) => (@attr fl type t = @attr ~a: int => unit type getInitialPropsFn<'a> = { - "query": Js.Dict.t, + "query": dict, "req": Js.Nullable.t>, } => Js.Promise.t> diff --git a/tests/syntax_tests/data/parsing/grammar/typexpr/expected/es6Arrow.res.txt b/tests/syntax_tests/data/parsing/grammar/typexpr/expected/es6Arrow.res.txt index 44c8a7b3ba..3fbf63b11a 100644 --- a/tests/syntax_tests/data/parsing/grammar/typexpr/expected/es6Arrow.res.txt +++ b/tests/syntax_tests/data/parsing/grammar/typexpr/expected/es6Arrow.res.txt @@ -72,6 +72,6 @@ type nonrec t = [ `Has_arity1 ]) function$)[@attrBeforeLblA ]) type nonrec t = ((a:((int)[@res.namedArgLoc ]) -> unit)[@attr ]) type nonrec 'a getInitialPropsFn = - (< query: string Js.Dict.t ;req: 'a Js.t Js.Nullable.t > -> + (< query: string dict ;req: 'a Js.t Js.Nullable.t > -> 'a Js.t Js.Promise.t, [ `Has_arity1 ]) function$ \ No newline at end of file diff --git a/tests/syntax_tests/data/printer/typexpr/arrow.res b/tests/syntax_tests/data/printer/typexpr/arrow.res index 78aaa06835..40993fbc5a 100644 --- a/tests/syntax_tests/data/printer/typexpr/arrow.res +++ b/tests/syntax_tests/data/printer/typexpr/arrow.res @@ -102,7 +102,7 @@ type arrows = (int, (float => unit) => unit, float) => unit let prepare_expansion: ((type_expr, type_expr)) => (type_expr, type_expr) = f type getInitialPropsFn<'a> = { - "query": Js.Dict.t, + "query": dict, "req": Js.Nullable.t>, } => Js.Promise.t> diff --git a/tests/syntax_tests/data/printer/typexpr/expected/arrow.res.txt b/tests/syntax_tests/data/printer/typexpr/expected/arrow.res.txt index d350436648..cd0180e929 100644 --- a/tests/syntax_tests/data/printer/typexpr/expected/arrow.res.txt +++ b/tests/syntax_tests/data/printer/typexpr/expected/arrow.res.txt @@ -222,7 +222,7 @@ type arrows = (int, (float => unit) => unit, float) => unit let prepare_expansion: ((type_expr, type_expr)) => (type_expr, type_expr) = f type getInitialPropsFn<'a> = { - "query": Js.Dict.t, + "query": dict, "req": Js.Nullable.t>, } => Js.Promise.t> diff --git a/tests/tests/src/UntaggedVariants.res b/tests/tests/src/UntaggedVariants.res index 2644c010d6..4e177b77a1 100644 --- a/tests/tests/src/UntaggedVariants.res +++ b/tests/tests/src/UntaggedVariants.res @@ -144,7 +144,7 @@ module Json = { | @as(null) Null | String(string) | Number(float) - | Object(Js.Dict.t) + | Object(dict) | Array(array) type tagged_t = @@ -153,7 +153,7 @@ module Json = { | JSONNull | JSONString(string) | JSONNumber(float) - | JSONObject(Js.Dict.t) + | JSONObject(dict) | JSONArray(array) let classify = (x: t) => @@ -319,7 +319,7 @@ module ComplexPattern = { | @as(null) Null | String(string) | Number(float) - | Object(Js.Dict.t) + | Object(dict) | Array(array) type tagged_t = @@ -328,7 +328,7 @@ module ComplexPattern = { | JSONNull | JSONString(string) | JSONNumber(float) - | JSONObject(Js.Dict.t) + | JSONObject(dict) | JSONArray(array) let someJson: t = %raw(`'[{"name": "Haan"}, {"name": "Mr"}, false]'`)->Obj.magic @@ -417,7 +417,7 @@ module AllInstanceofTypes = { } module Aliased = { - type dict = Js.Dict.t + type dict = dict type fn = unit => option @unboxed type t = Object(dict) | String(string) | Function(fn) diff --git a/tests/tests/src/bs_qualified.res b/tests/tests/src/bs_qualified.res index 425bf2fedc..279e418197 100644 --- a/tests/tests/src/bs_qualified.res +++ b/tests/tests/src/bs_qualified.res @@ -5,7 +5,7 @@ type param @scope("commands") @module("vscode") @variadic external executeCommands: (string, array) => unit = "executeCommands" -@scope("process") @val external env: Js.Dict.t = "env" +@scope("process") @val external env: dict = "env" let f = (a, b, c) => { executeCommands("hi", [a, b, c]) diff --git a/tests/tests/src/js_json_test.res b/tests/tests/src/js_json_test.res index a3478fbca7..7656d4568d 100644 --- a/tests/tests/src/js_json_test.res +++ b/tests/tests/src/js_json_test.res @@ -24,7 +24,7 @@ let () = { let ty = J.classify(v) switch ty { | J.JSONObject(x) => - /* compiler infer x : J.t Js.Dict.t */ + /* compiler infer x : J.t dict */ switch Js.Dict.get(x, "x") { | Some(v) => let ty2 = J.classify(v) diff --git a/tests/tests/src/reactDOMRe.res b/tests/tests/src/reactDOMRe.res index 1b3801d6dd..334f11c70c 100644 --- a/tests/tests/src/reactDOMRe.res +++ b/tests/tests/src/reactDOMRe.res @@ -2573,7 +2573,7 @@ module Style = { @val external combine: (@as(json`{}`) _, style, style) => t = "Object.assign" - external _dictToStyle: Js.Dict.t => style = "%identity" + external _dictToStyle: dict => style = "%identity" let unsafeAddProp = (style, key, value) => { let dict = Js.Dict.empty()