ocsigen / ts2ocaml

Generate OCaml bindings from TypeScript definitions via the TypeScript compiler API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsoo: spurious js.scope attribute

mirryi opened this issue · comments

Minimal repo

When trying to generate and compile stubs from @types/webextension-polyfill, I get the following error (using ts2ocaml 1.4.4):

File "webextension_polyfill.mli", line 26594, characters 10-18:
26594 |   module[@js.scope "types"] TypesStatic : sig
                  ^^^^^^^^
Error: Spurious js.scope attribute

File "webextension_polyfill.mli", line 9, characters 37-107:
9 | [@@@js.stop] module ExtensionTypes = M_________build__default__extension_types__index.Export.ExtensionTypes [@@@js.start] [@@@js.implem module ExtensionTypes = M_________build__default__extension_types__index.Export.ExtensionTypes]
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound module M_________build__default__extension_types__index

Not sure if I'm missing something with the setup. Any help at all would be appreciated!

It's a bug of ts2ocaml which sometimes generates an unnecessary js.scope attributes. Note that it would work if you remove [@js.scope "types"] manually.