haxiomic / dts2hx

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

Sample for Express.js doesn't work #102

Closed ebal5 closed 2 years ago

ebal5 commented 2 years ago

I want to use dts2hx and try to run sample in repo. But it didn't work. How can I fix it?

A list of actions what I've done are below.

  1. copy whole filed in Express Sample Directory
  2. run npm install
  3. run haxe build.hxml

then, I got error like this.

C:\HaxeToolkit\haxe\std/js/lib/Float64Array.hx:95: characters 28-65 : Type name js.lib.AsyncIterator is redefined from module js.lib.AsyncIterator
Server.hx:1: lines 1-39 : ... Defined in this class
C:\HaxeToolkit\haxe\std/js/lib/Float32Array.hx:95: characters 28-65 : Module js.lib.Iterator does not define type Iterator
Server.hx:1: lines 1-39 : ... Defined in this class
C:\HaxeToolkit\haxe\std/js/lib/Uint32Array.hx:94: characters 28-63 : Module js.lib.Iterator does not define type Iterator
Server.hx:1: lines 1-39 : ... Defined in this class
C:\HaxeToolkit\haxe\std/js/lib/Int32Array.hx:94: characters 28-63 : Module js.lib.Iterator does not define type Iterator

My Environments:

haxiomic commented 2 years ago

Hey @ebal5, looks like the haxe std library has added some more types in recent versions, dts2hx by default uses 4.0.5 stdlib types

you can solve this by adding --useSystemHaxe to the postinstall script

I've updated the Server example with this (and another small tweak in the haxe code required)

I've made --useSystemHaxe default in dts2hx 0.18

ebal5 commented 2 years ago

Thanks a lot! I'll try it later.