dukat icon indicating copy to clipboard operation
dukat copied to clipboard

Unused generated interfaces are not removed for meta types

Open Schahen opened this issue 5 years ago • 0 comments

following code:

declare function ping(): {a: string} | {b: number}

will be converted to:

external interface `T$0` {
    var a: String
}

external interface `T$1` {
    var b: Number
}

external fun ping(): dynamic /* `T$0` | `T$1` */                              

So in some cases dukat preserves generated interfaces for types that actually later on are erased. Ideally we won't have any reference for interfaces that are not used directly.

Strictly speaking the same should happen to tuples as well and ironically does not happen only because in a specific lowering tuple are missed. I'm going to introduce a regression of a sort returning this behaviour for tuples as well - and then fix in the framework of this issue.

Schahen avatar Jun 02 '20 00:06 Schahen