Rescript-compiler: allow variant to be converted to string as well

Created on 1 Jun 2018  路  3Comments  路  Source: rescript-lang/rescript-compiler

type t = A | B  [@@bs.deriving jsConverter{string : lowercase}]
HIGH

Most helpful comment

I'd rather us compile like swift:

[@customCompilation]
type t =
| [@as "a"] A
| [@as "b"] B

cc @cristianoc

All 3 comments

I'd rather us compile like swift:

[@customCompilation]
type t =
| [@as "a"] A
| [@as "b"] B

cc @cristianoc

Hi, what about a helper function like string_of_variant at least ??

This has been a high priority for over a year. Is there any progress on this?

This example shows something similar is the docs, but it doesn't work.
https://bucklescript.github.io/docs/en/generate-converters-accessors#usage-5

This is an extremely important feature for inter-op between reason and existing JS code. Can we please get some progress on this! Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wyze picture wyze  路  3Comments

bobzhang picture bobzhang  路  3Comments

alexfedoseev picture alexfedoseev  路  5Comments

bobzhang picture bobzhang  路  4Comments

jordwalke picture jordwalke  路  4Comments