rescript-lang / rescript-compiler

The compiler for ReScript.
https://rescript-lang.org
Other
6.62k stars 441 forks source link

@deriving(jsConverter) in uncurried mode outputs curried functions #6740

Closed bloodyowl closed 1 week ago

bloodyowl commented 3 months ago

Hi!

When switching a project in uncurried mode, it appears that the @deriving(jsConverter) are output in curried mode. I'm seing that https://github.com/rescript-lang/rescript-compiler/issues/6492 handed @deriving(abstract), would it be possible to also apply this change to jsConverter?

cometkim commented 3 months ago

I remember seeing this on the forum, but I don't know how it was done in the end.

If there is no other context, I think it should be fixed. Let me look into it.

cometkim commented 3 months ago

I just found https://github.com/rescript-lang/rescript-compiler/commit/639fcfd and seems @deriving(jsConverter) for records is not supported since v11

@bloodyowl Can you share the code you're migrating and the compiler output (including errors/warnings)?

bloodyowl commented 2 months ago

it's mostly for things like polymorphic variants:

@deriving(jsConverter)
type transport = [
  | #api
  | #csv
]

and records:

@deriving(jsConverter)
type site = {
  id: string,
  name: string,
  token: string,
  domain: string,
}

the errors are that the fromJs & toJs appear to be curried functions rather than uncurried ones

cristianoc commented 1 week ago

Fixed in recent uncurried work.