ocsigen / ts2ocaml

Generate OCaml bindings from TypeScript definitions via the TypeScript compiler API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keeping numbers at the start of union cases is invalid syntax with ReScript

Programmerino opened this issue · comments

export type Test = "1" | "2";

is converted to

@@uncurried
@@warning("-27-32-33-44")
open RescriptCore
open Ts2ocaml
module Test = {
  type t = 
    | @as("1") 1
    | @as("2") 2
}
module Export = {
  module Test = Test
}

Which is not allowed and causes At this point, I'm looking for an uppercased name like Belt or Array

I'm using ReScript 11.1.0-rc.3 and ts2ocaml 2.0.0-beta.2

@Programmerino Thank you for trying it out and reporting a bug! Do you happen to know what NPM package has a union type like this? (string enum with non-alphabet cases) The issue itself is trivial to fix but I would like to add it as a test package.

Sure! The issue was the translation of MemoryOption from https://github.com/firebase/firebase-functions/blob/master/src/v2/options.ts

The NPM package is firebase-functions, although I had a different problem with that project due to a dependency cycle, but I can open a separate issue for that.

Thank you! #394 looks like a more complicated issue, so I'll just merge #393 first and then take a close look at firebase-functions.