ocsigen / ts2ocaml

Generate OCaml bindings from TypeScript definitions via the TypeScript compiler API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash on @types/node/fs.d.ts

Lupus opened this issue · comments

ts2ocaml version 1.4.3

$ ./node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js jsoo -o output --preset=full --readable-names --follow-relative-references --rec-module optimized node_modules/@types/node/fs.d.ts
[0] []
[1] { types = [] }
[2] { types = [] }
Error: error!!!!!!!!!!!!!
    at al (/home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:129369)
    at dd (/home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:360617)
    at ud (/home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:354787)
    at t (/home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:385466)
    at /home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:385900
    at /home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:18561
    at Ue (/home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:16141)
    at at (/home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:18541)
    at jd (/home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:385736)
    at /home/vagrant/git/ts_to_mli/node_modules/@ocsigen/ts2ocaml/dist/ts2ocaml.js:2:388480

Wow, this should only occur when ts2ocaml got an empty union type...

I'll investigate it, it must have a really strange union type.

This was because of encoding?: null | undefined;. Ts2ocaml treated it as an optional field of an empty union type.