Closed
Description
Reference: scala-js/scala-js#4183
Minimized code
package test1
//...imports
@js.native
@JSImport("node-fetch", JSImport.Default)
def fetch2(url: String, arg: js.Dynamic): js.Promise[Response] = js.native
Output
fails with
[error] 19 |def fetch2(url: String, arg: js.Dynamic): js.Promise[Response] = js.native
[error] | ^^^^^^^^^
[error] | js.native may only be used as stub implementation in facade types
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
Expectation
It should compile.
Note
However, the more traditional way of writing it works:
@js.native
@JSImport("node-fetch", JSImport.Default)
object fetch extends js.Any:
def apply(url: String, arg: js.Dynamic): js.Promise[Response] = js.native