Kotlin / dukat

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

fix(#439): add ability to merge namespace enum as static nested enum class #449

Closed JSMonk closed 3 years ago

JSMonk commented 3 years ago

We didn't have logic related to merging nested inside namespace with class if the namespace contains an enum. This PR adds this logic to move namespace enum inside Kotlin class as a nested static enum class.

Example:

// index.d.ts
export class Foo {}
export namespace Foo {
    enum Bar {
         A,
         B
     }
}
// Current result
external open class Foo

// After those changes
external open class Foo {
    enum class Bar {
        A,
        B
    }
}