DZakh / rescript-schema

🧬 The fastest parser in the entire JavaScript ecosystem with a focus on small bundle size and top-notch DX
MIT License
160 stars 7 forks source link

[PPX] Cannot use @as inside inline records #69

Closed tsnobip closed 9 months ago

tsnobip commented 9 months ago

Hey, thanks a lot for the lib and for the PPX!

I bumped into this issue, let's say you define a variant with inline records like this:

@schema @tag("type")
type t =
  | @as("foo") Foo({@as("Foo") foo: string})
  | @as("bar") Bar({@as("Bar") bar: string})

You would get the following error:

The field Foo is not part of the record argument for the t.Foo constructor
Hint: Did you mean foo?

I don't know if it's a known issue or if it could be fixed.

DZakh commented 9 months ago

Thanks for reporting, it should work. I'll investigate and try to do a fix.

DZakh commented 9 months ago

Fixed in https://github.com/DZakh/rescript-schema/releases/tag/v6.4.0

tsnobip commented 9 months ago

Fixed in https://github.com/DZakh/rescript-schema/releases/tag/v6.4.0

Wow thanks a lot!