Kotlin / dukat

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

Missing -Partial declaration for imported parent interface (compile error) #416

Open joffrey-bion opened 3 years ago

joffrey-bion commented 3 years ago

When Partial<T> is used on a subinterface, both the child and the parent interface get a proper -Partial variant generated. However, if the parent interface comes from a different file, no -Partial variant is generated for it:

parent.ts:

export interface Parent {
  parentProp: string;
}

child.ts:

import { Parent } from './parent';
export interface Child extends Parent {
  childProp: string;
}
export declare class MyClass {
  partialProp: Partial<Child>
}

Generated:

interface Parent {
    var parentProp: String
}
// no ParentPartial interface here

And:

interface Child : Parent {
    var childProp: String
}
// ParentPartial used here but not declared anywhere (and not imported)
external interface ChildPartial : ParentPartial {
    var childProp: String?
        get() = definedExternally
        set(value) = definedExternally
}
external open class MyClass {
    open var partialProp: ChildPartial
}

This was noticed in version 0.5.8-rc.0 of Dukat.