Open vlsi opened 4 years ago
@file:JsModule("fs/promises")
produces
Caused by: java.lang.IllegalStateException: Module 'fs/promises' not found
at org.jetbrains.kotlin.gradle.internal.ExecKt$execWithErrorLogger$1.invoke(exec.kt:91)
at org.jetbrains.kotlin.gradle.internal.ExecKt$execWithErrorLogger$1.invoke(exec.kt)
at org.jetbrains.kotlin.gradle.internal.ProgressKt.operation(progress.kt:23)
at org.jetbrains.kotlin.gradle.internal.ProgressKt.operation$default(progress.kt:15)
at org.jetbrains.kotlin.gradle.internal.ExecKt.execWithErrorLogger(exec.kt:75)
at org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackRunner.execute(KotlinWebpackRunner.kt:24)
at org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack.doExecute(KotlinWebpack.kt:229)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:726)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:693)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:569)
The following works (I'm not sure if it should work or if it should not):
@file:JsModule("fs")
@file:JsQualifier("promises")
package ...
import kotlin.js.Promise
external fun unlink(paths: String): Promise<Unit>
cc @ilgonmic
See https://nodejs.org/api/fs.html#fs_fs_promises_api
It looks like
fs.promises
is not right here: https://github.com/Kotlin/kotlinx-nodejs/blob/85512009c3b8f14449a7dbd8305a9fef797d6afb/kotlinx-nodejs/src/fs.fs.promises.module_node.kt#L1I'm not sure what
declare module "fs/promises"
means in TypeScript, however, the following Kotlin declaration works: