Skip to content

Commit b4c4206

Browse files
committed
change Promise.t to promise in a few places
1 parent c7da0ff commit b4c4206

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/Core__Promise.resi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type t<+'a> = promise<'a>
1212
[resolve(value)] creates a resolved Promise with a given `value`
1313
1414
```rescript
15-
let p = Promise.resolve(5) // Promise.t<int>
15+
let p = Promise.resolve(5) // promise<int>
1616
```
1717
*/
1818
@val
@@ -68,7 +68,7 @@ reject(SomeError("this is an error"))
6868
->catch(e => {
6969
let msg = switch(e) {
7070
| SomeError(msg) => "ReScript error occurred: " ++ msg
71-
| JsError(obj) =>
71+
| Js.Exn.Error(obj) =>
7272
switch Js.Exn.message(obj) {
7373
| Some(msg) => "JS exception occurred: " ++ msg
7474
| None => "Some other JS value has been thrown"
@@ -180,7 +180,7 @@ let promises = [resolve(1), resolve(2), resolve(3)]
180180
181181
all(promises)
182182
->then((results) => {
183-
ReScriptJs.Js.Array.forEach(results, (num) => {
183+
results->Array.forEach(num => {
184184
Console.log2("Number: ", num)
185185
})
186186
@@ -231,7 +231,7 @@ external all6: ((t<'a>, t<'b>, t<'c>, t<'d>, t<'e>, t<'f>)) => t<('a, 'b, 'c, 'd
231231
/**
232232
`done` is a safe way to ignore a promise. If a value is anything else than a promise, it will raise a type error.
233233
*/
234-
external done: Js.Promise.t<'a> => unit = "%ignore"
234+
external done: promise<'a> => unit = "%ignore"
235235

236236
external unsafe_async: 'a => promise<'a> = "%identity"
237237
external unsafe_await: promise<'a> => 'a = "?await"

test/PromiseTest.res

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module ThenChaining = {
4343
})
4444
}
4545

46-
// It's not allowed to return a Promise.t<Promise.t<'a>> value
46+
// It's not allowed to return a promise<promise<'a>> value
4747
// within a then. This operation will throw an error
4848
let testInvalidThen = () => {
4949
open Promise
@@ -138,7 +138,7 @@ module Rejection = {
138138
}
139139

140140
module Catching = {
141-
let asyncParseFail: unit => Js.Promise.t<string> = %raw(`
141+
let asyncParseFail: unit => promise<string> = %raw(`
142142
function() {
143143
return new Promise((resolve) => {
144144
var result = JSON.parse("{..");
@@ -153,7 +153,7 @@ module Catching = {
153153
open Promise
154154

155155
asyncParseFail()
156-
->then(_ => resolve()) // Since our asyncParse will fail anyways, we convert to Promise.t<unit> for our catch later
156+
->then(_ => resolve()) // Since our asyncParse will fail anyways, we convert to promise<unit> for our catch later
157157
->catch(e => {
158158
let success = switch e {
159159
| Js.Exn.Error(err) => Js.Exn.message(err) == Some("Unexpected token . in JSON at position 1")

test/TempTests.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ let withNewProp = Object.assign(copy, {"bar": "baz"})
109109
Console.info("")
110110
Console.info("Promise")
111111
Console.info("---")
112-
let promise: Promise.t<int> = Promise.make((resolve, _reject) => {
112+
let promise: promise<int> = Promise.make((resolve, _reject) => {
113113
let _ = setTimeout(() => {
114114
resolve(. 1)
115115
}, 100)

0 commit comments

Comments
 (0)