Closed
Description
Consider this example:
let wrapSomethingAsync: unit => unit = () => {
let asyncFn = async () => {
let test = await Js.Promise.resolve("Test")
Js.log(test)
}
let _ = asyncFn()
}
this works and creates the following JS
function wrapSomethingAsync(param) {
var asyncFn = async function (param) {
var test = await Promise.resolve("Test");
console.log(test);
};
asyncFn(undefined);
}
but when I immediately invoke the async function and make it anonymous
let wrapSomethingAsync: unit => unit = () => {
let _ = (
async () => {
let test = await Js.Promise.resolve("Test")
Js.log(test)
}
)()
}
it compiles to
function wrapSomethingAsync(param) {
var test = await Promise.resolve("Test");
console.log(test);
}
which misses the async keyword somewhere.
Metadata
Metadata
Assignees
Labels
No labels