Kotlin / dukat

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

npm("@types/express", "4.17.7") generates invalid code #355

Open vlsi opened 4 years ago

vlsi commented 4 years ago

Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/81dde526431a19d4a448d75dcdc9d19d6b806a0e/types/express/index.d.ts#L111

import * as core from "express-serve-static-core";

/**
 * Creates an Express application. The express() function is a top-level function exported by the express module.
 */
declare function e(): core.Express;

declare namespace e {
    interface Express extends core.Express { }
    interface Handler extends core.Handler { }
    interface IRoute extends core.IRoute { }
    interface IRouter extends core.IRouter { }
    interface IRouterHandler<T> extends core.IRouterHandler<T> { }
    interface IRouterMatcher<T> extends core.IRouterMatcher<T> { }

Sample code:

Errors are There's a cycle in the inheritance hierarchy for this type

external interface Express : Express // <--  There's a cycle in the inheritance hierarchy for this type

external interface Handler : Handler

external interface IRoute : IRoute

external interface IRouter : IRouter

external interface IRouterHandler<T> : IRouterHandler<T>
ivakub commented 4 years ago

Similar issue: https://youtrack.jetbrains.com/issue/KT-40773