dukat icon indicating copy to clipboard operation
dukat copied to clipboard

Express has multiple errors

Open ScottPierce opened this issue 4 years ago • 1 comments

I'm using Dukat 0.0.28

I ran the following command on express in my node_modules/@types directory. Here is my @types directory as a reference: @types.zip

dukat -d ../../../../../external-definitions/express/src/main/kotlin/ index.d.ts

The compilation works, but there are several errors:

  1. The main external declaration is exposed as an unexpected function called e:
@JsModule("express")
external fun e(): Express

I found this exact same problem when using the cors library. Typically you'd call cors(<options>), but dukat was listing it's primary function as e instead of cors.

  1. This entire core package is unresolved.
@file:JsModule("express")
@file:JsNonModule
@file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS", "EXTERNAL_DELEGATION")
package e

import kotlin.js.*
import kotlin.js.Json
import org.khronos.webgl.*
import org.w3c.dom.*
import org.w3c.dom.events.*
import org.w3c.dom.parsing.*
import org.w3c.dom.svg.*
import org.w3c.dom.url.*
import org.w3c.fetch.*
import org.w3c.files.*
import org.w3c.notifications.*
import org.w3c.performance.*
import org.w3c.workers.*
import org.w3c.xhr.*
import ParamsDictionary

external var json: Any

external var raw: Any

external var text: Any

external var application: Application

external var request: Request<ParamsDictionary>

external var response: Response

external var static: Any

external var urlencoded: Any

external fun Router(options: RouterOptions = definedExternally): core.Router

external interface RouterOptions {
    var caseSensitive: Boolean?
        get() = definedExternally
        set(value) = definedExternally
    var mergeParams: Boolean?
        get() = definedExternally
        set(value) = definedExternally
    var strict: Boolean?
        get() = definedExternally
        set(value) = definedExternally
}

external interface Application : core.Application

external interface CookieOptions : core.CookieOptions

external interface Errback : core.Errback

external interface ErrorRequestHandler<P> : core.ErrorRequestHandler<P>

external interface Express : core.Express

external interface Handler : core.Handler

external interface IRoute : core.IRoute

external interface IRouter : core.IRouter

external interface IRouterHandler<T> : core.IRouterHandler<T>

external interface IRouterMatcher<T> : core.IRouterMatcher<T>

external interface MediaType : core.MediaType

external interface NextFunction : core.NextFunction

external interface Request<P> : core.Request<P>

external interface RequestHandler<P> : core.RequestHandler<P>

external interface RequestParamHandler : core.RequestParamHandler

external interface Response : core.Response

external interface Router : core.Router

external interface Send : core.Send
  1. SO many other unresolved references / random compilation issues. Most of the issues are difficult to debug / fix by yourself, and I'm left just giving up on dukat again.

ScottPierce avatar Feb 25 '20 22:02 ScottPierce

Minimal example:

//_api
export interface Application {
}
import * as core from "_api";

declare namespace e {
  interface Application extends core.Application { }
}

it's important to have an interface with the same name as qualified import.

Schahen avatar Feb 29 '20 01:02 Schahen