Kotlin / dukat

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

@amcharts/amcharts4 compilation errors #463

Open piacenti opened 2 years ago

piacenti commented 2 years ago

πŸ•— Version 0.5.8-rc.4

πŸ’» Code or Package Name: @amcharts/amcharts4

πŸ™ Actual behavior

running dukat core.d.ts from the amcharts folder generates kotlin full of compiler errors. Some of them seem to stem from inheritance where an interface expects a function clone() to be implemented while a TS subclass implements that by doing clone(id:String). There are also errors around subclass variables that use a subtype of what the parent expects which the compiler takes as an error. Example:

external open class BlurFilter : Filter {
    override var _properties: BlurFilterProperties
    open var feGaussianBlur: AMElement
    open var blur: Number
}

This class has both errors mentioned above. It doesn't implement clone() as expected by Kotlin (although it is implemented as clone(id:String) by a parent class). It uses override var _properties: BlurFilterProperties which overrides the parent open var _properties: FilterProperties where BlurFilterProperties is an interface that extends the FilterProperties interface. The compiler doesn't like the use of BlurFilterProperties there. There are several other issues around generics.

πŸ™‚ Expected behavior

Get code that can be compiled

piacenti commented 2 years ago

I haven't looked at the implementation but may be worth turning the interface definition of fun clone() to fun clone(vararg params:Any?) once identified situations where it is implemented with different number of arguments.