Is it possible to have multiple @deriving decorators?

I need to have @deriving(accessors) as well as @deriving(jsConverter) for the the same variant, but it doesn’t seem the compiler let’s me do this.

Having both @deriving statements won’t work, because of duplicate bs.deriving attribute.

If I do this: @deriving(accessors; jsConverter), I get bs.deriving warning: invalid attribute config-record, ignoring and they are indeed ignored. Comma doesn’t work either.

Is this impossible? I haven’t found anything about this in the docs.

You can do @deriving({accessors,jsConverter}).

6 Likes