haxiomic / dts2hx

Converts TypeScript definition files (d.ts) to haxe externs (.hx) via the TypeScript compiler API
MIT License
135 stars 9 forks source link

libp2p interface bug #97

Open sonygod opened 3 years ago

sonygod commented 3 years ago

I use dts2hx for libp2p

node_modules\libp2p-interfaces\dist\src\transport\types.d.ts

export interface TransportFactory<DialOptions extends { signal?: AbortSignal }, ListenerOptions> {
  new(upgrader: Upgrader): Transport<DialOptions, ListenerOptions>;
}

will gen wrong code here

package libp2p.dist.src.transport_manager;

typedef TransportFactory = libp2p_interfaces.dist.src.transport.types.TransportFactory<Dynamic, Dynamic>;

npx dts2hx libp2p --tsconfig ./tsconfig.json --verbose

here is tsconfig.json

{
    "extends": "./node_modules/aegir/src/config/tsconfig.aegir.json",
    "compilerOptions": {
      "outDir": "dist",
      "lib": [
        "esnext.asynciterable",
        "ES2019",
        "es2018",
        "ES2019.Array",
        "ES2019.Object",
        "ES2019.String",
        "ES2019.Symbol",
        "ES2020"
      ],
      "types": ["node"]
    },
    "include": [
      "src"
    ],
    "exclude": [
      "src/circuit/protocol/index.js", // exclude generated file
      "src/identify/message.js", // exclude generated file
      "src/insecure/proto.js", // exclude generated file
      "src/peer-store/persistent/pb/address-book.js", // exclude generated file
      "src/peer-store/persistent/pb/proto-book.js", // exclude generated file
      "src/record/peer-record/peer-record.js", // exclude generated file
      "src/record/envelope/envelope.js" // exclude generated file
    ]
  }