https://kotlinlang.org logo
#compiler
Title
# compiler
n

Nick

12/13/2023, 4:00 PM
I'm hitting KT-57614 with code that exposes DOM types in common code. Doodle uses this approach currently, and relies on aliasing for the actual type in JS. Unfortunately, none of the work-arounds mentioned in the issue work b/c I don't control the definition for the impl type I'm aliasing. So removing the default value from my expect statement simply raises new errors:
Copy code
e: file:///Users/neddy/Development/Projects/doodle/Browser/src/jsMain/kotlin/io/nacular/doodle/HTMLElement.kt:116:27 Actual class 'Document' has no corresponding members for expected class members:

    internal final expect fun createElement(localName: String, options: ElementCreationOptions /* = ElementCreationOptions */): Element /* = Element */

    The following declaration is incompatible because actual function cannot have default argument values, they should be declared in the expected function:
        public final fun createElement(localName: String, options: ElementCreationOptions = ...): Element

    internal final expect fun createElementNS(namespace: String?, qualifiedName: String, options: ElementCreationOptions /* = ElementCreationOptions */): Element /* = Element */

    The following declaration is incompatible because actual function cannot have default argument values, they should be declared in the expected function:
        public final fun createElementNS(namespace: String?, qualifiedName: String, options: ElementCreationOptions = ...): Element
d

dmitriy.novozhilov

12/13/2023, 4:08 PM
Please don't crosspost messages between channels
👍 1
2 Views