Kotlin / dukat

Converter of <any kind of declarations> to Kotlin external declarations
553 stars 44 forks source link

nodejs stream.pipeline and stream.finished are imported into "internal" class #347

Open vlsi opened 4 years ago

vlsi commented 4 years ago

https://github.com/Kotlin/kotlinx-nodejs/blob/201d2877be634c0d38cc4ef957d4d58a48903c4f/kotlinx-nodejs/src/stream.stream.module_node.kt#L30

@JsModule("stream")
external open class internal : EventEmitter {
    companion object {
        fun finished(stream: ReadableStream, options: FinishedOptions, callback: (err: ErrnoException?) -> Unit): () -> Unit

This makes the usage awkward: stream.internal.finished(...)

JavaScript use is as follows (no internal):

const { pipeline, finished } = require('stream');

finished(...)
Schahen commented 4 years ago

I'm adding need research because while you are 100% correct without how the actual definitions look like, typescript definitions are written that way and we need to investigate what its exact set of rules we will rely on for eliminating redundant namespace automatically