diff --git a/compiler/ml/ast_untagged_variants.ml b/compiler/ml/ast_untagged_variants.ml index ab53f3961e..0bdaa8d220 100644 --- a/compiler/ml/ast_untagged_variants.ml +++ b/compiler/ml/ast_untagged_variants.ml @@ -166,7 +166,7 @@ let type_to_instanceof_backed_obj (t : Types.type_expr) = | Tconstr (path, _, _) when Path.same path Predef.path_array -> Some Array | Tconstr (path, _, _) -> ( match Path.name path with - | "Js_date.t" -> Some Date + | "Date.t" -> Some Date | "Js_re.t" -> Some RegExp | "Js_file.t" -> Some File | "Js_blob.t" -> Some Blob diff --git a/runtime/Date.res b/runtime/Date.res index 925afcc190..02ffee6d89 100644 --- a/runtime/Date.res +++ b/runtime/Date.res @@ -1,4 +1,4 @@ -type t = Js.Date.t +type t type msSinceEpoch = float diff --git a/runtime/Date.resi b/runtime/Date.resi index f0d975ba1a..1e67a96c1a 100644 --- a/runtime/Date.resi +++ b/runtime/Date.resi @@ -5,7 +5,7 @@ /** A type representing a JavaScript date. */ -type t = Js.Date.t +type t /** Time, in milliseconds, since / until the UNIX epoch (January 1, 1970 00:00:00 UTC). diff --git a/runtime/Js_date.res b/runtime/Js_date.res index 2a7b6be24b..aaad41215f 100644 --- a/runtime/Js_date.res +++ b/runtime/Js_date.res @@ -29,7 +29,7 @@ on MDN.) JavaScript stores dates as the number of milliseconds since the UNIX *epoch*, midnight 1 January 1970, UTC. */ -type t +type t = Date.t @send /** diff --git a/runtime/Pervasives.res b/runtime/Pervasives.res index 8f05695ddc..04c721aacb 100644 --- a/runtime/Pervasives.res +++ b/runtime/Pervasives.res @@ -1,15 +1,11 @@ -/** - Since [others] depend on this file, its public mli files **should not - export types** introduced here, otherwise it would cause - conflicts here. +/* Core type aliases */ - If the type exported here is also exported in modules from others, - you will get a type not equivalent. -*/ -@deprecated("Do not use. This will be removed in v13") -external /* Internal */ +type date = Date.t -__unsafe_cast: 'a => 'b = "%identity" +/* Internal */ + +@deprecated("Do not use. This will be removed in v13") +external __unsafe_cast: 'a => 'b = "%identity" /* Exceptions */ 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/Date.res b/tests/gentype_tests/typescript-react-example/src/Date.res deleted file mode 100644 index 9cee890bbc..0000000000 --- a/tests/gentype_tests/typescript-react-example/src/Date.res +++ /dev/null @@ -1 +0,0 @@ -type t = Js.Date.t diff --git a/tests/gentype_tests/typescript-react-example/src/DateTest.res b/tests/gentype_tests/typescript-react-example/src/DateTest.res new file mode 100644 index 0000000000..613500307a --- /dev/null +++ b/tests/gentype_tests/typescript-react-example/src/DateTest.res @@ -0,0 +1 @@ +type t = Date.t diff --git a/tests/gentype_tests/typescript-react-example/src/Date.res.js b/tests/gentype_tests/typescript-react-example/src/DateTest.res.js similarity index 100% rename from tests/gentype_tests/typescript-react-example/src/Date.res.js rename to tests/gentype_tests/typescript-react-example/src/DateTest.res.js 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..c7d074824d 100644 --- a/tests/gentype_tests/typescript-react-example/src/nested/Types.res +++ b/tests/gentype_tests/typescript-react-example/src/nested/Types.res @@ -122,7 +122,7 @@ type instantiateTypeParameter = ocaml_array @genType @genType.as("Vector") type vector<'a> = ('a, 'a) -@genType type date = Js.Date.t +@genType type date = Date.t @genType let currentTime = Js.Date.make() diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/shared/DateTime.res b/tests/syntax_tests/data/idempotency/pupilfirst/shared/DateTime.res index b902ba4261..b0b83d9bcd 100644 --- a/tests/syntax_tests/data/idempotency/pupilfirst/shared/DateTime.res +++ b/tests/syntax_tests/data/idempotency/pupilfirst/shared/DateTime.res @@ -1,4 +1,4 @@ -type t = Js.Date.t +type t = Date.t @val @module("date-fns") external dateFormat: (t, string) => string = "format" diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/shared/DateTime.resi b/tests/syntax_tests/data/idempotency/pupilfirst/shared/DateTime.resi index 0bcbd37e00..1dcf30fdea 100644 --- a/tests/syntax_tests/data/idempotency/pupilfirst/shared/DateTime.resi +++ b/tests/syntax_tests/data/idempotency/pupilfirst/shared/DateTime.resi @@ -1,4 +1,4 @@ -type t = Js.Date.t +type t = Date.t type format = | OnlyDate