DZakh / rescript-schema

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

ReScript 12 compatibility #78

Open cknitt opened 3 months ago

cknitt commented 3 months ago

This may be a bit early as there is not even a first alpha version of ReScript 12 out yet, but I wanted to give you a heads-up already.

It seems something broke with https://github.com/rescript-lang/rescript-compiler/pull/6611.

E.g., if I have a simple union schema

type x = A | B

let schema = S.union([S.literal(A), S.literal(B)])

then S.parseOrRaiseWith(JSON.String("B"), schema) gives me the error

Failed parsing at root. Reason: Expected "A", received "B"

on latest (ReScript) master.

DZakh commented 3 months ago

It seems something broke with https://github.com/rescript-lang/rescript-compiler/pull/6611.

Oh, nice that it was merged. Yeah, that's probably the reason, since I do a dirty thing, to make RescriptSchemaError a valid Error instance and ReScript exception at the same time. I'll do a fix closer to the V12 release.

cknitt commented 3 months ago

12.0.0-alpha.1 is out now! 🎉

cknitt commented 3 months ago

I am also seeing the following error (without a line number) when using the PPX with 12.0.0-alpha.1:

  This uncurried function has type 'a => 'b
  It is applied with 2 arguments but it requires 1.
DZakh commented 3 months ago

Started the migration. I'm currently blocked by this https://github.com/rescript-lang/rescript-compiler/issues/6929