Giter Site home page Giter Site logo

Comments (11)

zth avatar zth commented on June 8, 2024 2

Sure! Check this repo out: https://github.com/zth/relay/tree/rescript-relay. It's the Relay compiler fork RescriptRelay uses. It's in the compiler/ dir.

Place yourself in the compiler/test-project-res dir and run cargo build && ../target/debug/relay. That'll compile the compiler and run it on the test project. You'll see any changes you make reflected there.

Adding @as() is hopefully fairly straight forward. There should be plenty of examples in the code base.

from rescript-relay.

mununki avatar mununki commented on June 8, 2024

Currently my project using "rescript": "v11-rc.4" and "rescript-relay": "^2.0.0" with uncurried: true. I have input type in graphQL schema:

input ShippingFeePolicyMutationInput {
  amount: Int!
  freeShippingThreshold: Int
  quantityStep: Int
  type: ShippingFeePolicyType!
}

The js output has _type instead of type now with this ReScript code.

Mutation.make_shippingFeePolicyMutationInput(~amount=0, ~_type=#FREE, ())
{
  amount: 0,
  _type: "FREE"
}

But, I can't figure it out why because playground looks fine to me. https://rescript-lang.org/try?version=v11.0.0-beta.4&code=AIGwlgbgpgUALgTwA5QARgHZIK5wPoDKAFmEkpgOYBiUUACgPbgDGCAsrgIZxgMYCSWXKgC8qAN4xUqTgFsG2DHABc6JQBopqAGYAnWsVLkMFACpF9AZyJMAJqoZIefADyY4APk3SAjtk5KYIgEcFBIDk68GG5KXlrAnJYAFABEiCgpAJSo6VB4qgDaAMQAwgDyAHIAIvym-JUAggAyeFQASgCiHagAPqhF7V29-RVlpngNdHRN-CUNAEJN3X1FdA38VcNFAIoAqg0VdaYAmnjzDQQdVQC6mgC+MDCgkGjADABGAFaoUAAeoboMJwQKhZJwANZ5axGSg0ehMMCsDhwbhRQQ4FSoJJaaQAPzkCiUqnc3mkqFxegMJDIlHMVhsIHsajgIgA-KS8X4AjxgqFwsy2RzyXhcoUcWSVuVqrV6hVmq1Oh1xdIVoMlWSJSMxhMpjM5ot1RqtmsNsqtnsDkdTudLlVxbdxYoglpsiIPGoMYRqcZqLRGCx2FxnAIhHBRKgUilHiAoGHZOGwZC8NCaSY4f7EYGUcH0bgkvj5IoWQAGdTC3IiAaKstJTKZIA

from rescript-relay.

mununki avatar mununki commented on June 8, 2024

The functions and type definition are extracted from the generated modules by rescript-relay.

from rescript-relay.

DZakh avatar DZakh commented on June 8, 2024

It's the same issue I've described in the description.
That's because of the PR: rescript-lang/rescript-compiler#6354
Fix in the PR: zth/relay#15

from rescript-relay.

mununki avatar mununki commented on June 8, 2024

@DZakh Can you check the playground link I've added? I'm wondering why this output has type.
image

from rescript-relay.

DZakh avatar DZakh commented on June 8, 2024

See rescript-lang/rescript-compiler#6354.
There used to be the logic of mangling object keys up till 11-rc.3

from rescript-relay.

DZakh avatar DZakh commented on June 8, 2024

I think the change should be highlighted more in ReScript V11 release notes. It's a breaking change people should know about.

from rescript-relay.

mununki avatar mununki commented on June 8, 2024

Ah! I confused the setting of playground it was v11-beta.4 not rc.3 😓

from rescript-relay.

mununki avatar mununki commented on June 8, 2024

I opened an issue rescript-lang/rescript-compiler#6440, if the js output is generated by the return type of the external function, then _type issue here would be fixed, I guess.

from rescript-relay.

DZakh avatar DZakh commented on June 8, 2024

Yes, but I think it'll be quite difficult to make it work. Also, if you noticed, in our case the type has a field called type_, while external has a field called _type.

from rescript-relay.

zth avatar zth commented on June 8, 2024

2.1.0 is out, and should fix this. Reopen if it does not.

from rescript-relay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.