-
Notifications
You must be signed in to change notification settings - Fork 477
Closed
Milestone
Description
While migrating a large project to use async/await, I came across the following problem:
type data
@module("SomeModule")
external fetchData: string => promise<data> = "fetchData"
let promiseCreators = ["1", "2"]->Js.Array2.map(id => async () => await fetchData(id))compiles to
var promiseCreators = [
"1",
"2"
].map(function (id) {
return function (param) {
return await SomeModule.fetchData(id);
};
});which is not valid because the inner function contains an await, but is not annotated with async.
This occurs in both 10.1.2 and current master.
https://rescript-lang.org/try?version=v10.1.2&code=C4TwDgpgBAJghsOAoJABAtgexgVwDYQAUARAMqboQCy2+ExAlEhAB7AQBOAdnHlAGYRgAYwAWAEQRwAXFADOwDgEsuAcygBeAHxQwHCkrkQAPPEQ6NUYoJESpxFAWC796QxADCHCAkwc5mlAA2sQAjMQANFYATMQAugC0WgBScgB0AIIcHHAg0WnocGCESjCaOnByIFzCUIQM5VBwAO5wSs42YpKIJTAMTEA
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels