Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra parentheses in pipe operator cause code to fail compilation. #6659

Open
Mng12345 opened this issue Feb 28, 2024 · 1 comment
Open

Extra parentheses in pipe operator cause code to fail compilation. #6659

Mng12345 opened this issue Feb 28, 2024 · 1 comment

Comments

@Mng12345
Copy link

module Codec = {
  type encode<'v> = 'v => Js.Json.t
  type decode<'v> = Js.Json.t => result<'v, exn>
  type t<'v> = {
    encode: encode<'v>,
    decode: decode<'v>,
  }

  let make = (encode, decode) => {encode: encode, decode: decode}

  let encode = codec => codec.encode
  let encodeString = (codec, value) => codec->encode(value)->Js.Json.stringify

  let decode = codec => codec.decode
}

The code above can be compiled in Rescript v10, but can not be compiled in V11.0.1
v10 playground

v11.0.1 playground

This code snippest is from the rescript-jzon library, and it prevents me from upgradding to Rescript v11.

@DZakh
Copy link
Contributor

DZakh commented Feb 28, 2024

You can use https://github.com/ds300/patch-package or https://pnpm.io/cli/patch. Or prepare a PR to add V11 support for rescript-jzon. I know the author and can ping him for review. He's not using ReScript anymore, so probably he won't have time to update the package by himself. Also, you can migrate to rescript-schema 😈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants