Kotlin / dukat

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

Exported type aliases are missing #299

Closed Schahen closed 4 years ago

Schahen commented 4 years ago

Following code:

// api.d.ts
export interface A { }
export type B = A;

and

import {A, B} from "./api";

declare class C implements A { }
declare class D implements B { }

is translated to:

// api
external interface A
// app

external open class C : A
external open class D : A

While ideally I would expect to have:

// api
external interface A

typealias B = A
// app

external open class C : A
external open class D : B

I actually should check - there might be some issues with inheriting from aliases but even if there are - as of now we are missing type alias unintentionally - it's just happened to be missed - so it's better to translate typealias and omit it later on if needed.

Also, this is related to https://github.com/Kotlin/dukat/issues/270 (this is how I discovered this one actually)