dukat icon indicating copy to clipboard operation
dukat copied to clipboard

jQuery conversion generates "Overload resolution ambiguity"-prone methods

Open nanodeath opened this issue 8 years ago • 2 comments

Converting jQuery doesn't yield any direct errors, but I was expecting to be able to write

jQuery("#foo")

as a result. However, this is invalid, as all of the four overloads match equally well:

    @nativeInvoke
    operator fun invoke(selector: String, context: Element? = definedExternally /* null */): JQuery
    @nativeInvoke
    operator fun invoke(selector: String, context: JQuery? = definedExternally /* null */): JQuery
    @nativeInvoke
    operator fun invoke(`object`: Any): JQuery
    @nativeInvoke
    operator fun invoke(html: String, ownerDocument: Document? = definedExternally /* null */): JQuery
/home/max/IdeaProjects/kiq
├── @types/[email protected]
└─┬ [email protected]
  └── [email protected]

nanodeath avatar Apr 16 '17 17:04 nanodeath

as a workaround, You can manually add

    @nativeInvoke
    operator fun invoke(selector: String): JQuery

bashor avatar Apr 17 '17 15:04 bashor

This reproduces for kotlinx-nodejs 0.0.7 :(

fs.createReadStream(path)

Overload resolution ambiguity:
public external fun createReadStream(path: String, options: `T$50` = ...): ReadStream defined in fs
public external fun createReadStream(path: String, options: String = ...): ReadStream defined in fs

Buffer.alloc(size)

Overload resolution ambiguity:
public final fun alloc(size: Number, fill: Buffer = ..., encoding: String = ...): Buffer defined in Buffer.Companion
public final fun alloc(size: Number, fill: Number = ..., encoding: String = ...): Buffer defined in Buffer.Companion
public final fun alloc(size: Number, fill: String = ..., encoding: String = ...): Buffer defined in Buffer.Companion

vlsi avatar Sep 10 '20 20:09 vlsi