diff --git a/lib/js/asyncjs.nim b/lib/js/asyncjs.nim index 45053fbaa923..b42ce45d8733 100644 --- a/lib/js/asyncjs.nim +++ b/lib/js/asyncjs.nim @@ -118,10 +118,11 @@ proc generateJsasync(arg: NimNode): NimNode = var resolve: NimNode if isVoid: resolve = quote: - var `jsResolve` {.importcpp: "undefined".}: Future[void] + var `jsResolve` {.importjs: "undefined".}: Future[void] else: resolve = quote: - proc jsResolve[T](a: T): Future[T] {.importcpp: "#", used.} + proc jsResolve[T](a: T): Future[T] {.importjs: "#", used.} + proc jsResolve[T](a: Future[T]): Future[T] {.importjs: "#", used.} result.body.add(resolve) else: result.body = newEmptyNode() diff --git a/tests/js/t17177.nim b/tests/js/t17177.nim new file mode 100644 index 000000000000..fc362cec1bf2 --- /dev/null +++ b/tests/js/t17177.nim @@ -0,0 +1,10 @@ +import std/asyncjs + +proc fn1(n: int): Future[int] {.async.} = return n +proc main2() = + proc fn2(n: int): Future[int] {.async.} = return n +proc main3(a: auto) = + proc fn3(n: int): Future[int] {.async.} = return n +proc main4() {.async.} = + proc fn4(n: int): Future[int] {.async.} = return n + discard