Giter Club home page Giter Club logo

Comments (10)

alloy avatar alloy commented on August 27, 2024 2

DT typings have no notion of semver.

I currently do not have any spare time to spend on this, so I'd love somebody else to PR a solution. I agree with @mattkrick that it is likely we'll need separate types for <2 and >=2, but that might be a bit much to tackle now, so for expediency sake perhaps most of those changes should be reverted for now?

from relay-compiler-language-typescript.

artola avatar artola commented on August 27, 2024 2

@steida Solution coming as relaxed typings v1.3.12
https://www.npmjs.com/package/@types/relay-runtime

Thanks @mattkrick @alloy @sibelius

from relay-compiler-language-typescript.

steida avatar steida commented on August 27, 2024 1

Sure I can, but that's why I generate types. To use them.

from relay-compiler-language-typescript.

artola avatar artola commented on August 27, 2024 1

@mattkrick @alloy @sibelius Same for me. With @types/relay-runtime v1.3.8 works because of ConcreteRequest = any while with v1.3.10 breaks. I think that it is a problem with the typings because by semver, it is a breaking change ... not just a patch.
Could be possible to fix this issue:

  • relax the types for ConcreteRequest in the typings
  • fix this package to output compatible with v1.3.10
    ?

from relay-compiler-language-typescript.

mattkrick avatar mattkrick commented on August 27, 2024

you know, that's probably my bad, i made the typedef more strict to add support for getRequest.
relay v1.7.0 changed the defs a little bit, & now relay v2.0.0 has completely revamped the shape of some of these interfaces:

unless you're calling getRequest in your app, none of this really matters.

the right thing to do would be to release new typedefs for v.1.7.0 and another one for v2.0.0 (and my gut tells me that as @match matures, we'll need new defs for the next version, too)

the fast thing to do would be to excluded generated files from type checking, which should speed up build times, too

from relay-compiler-language-typescript.

sibelius avatar sibelius commented on August 27, 2024

ConcreteRequest will change very often, maybe it could be any or unknow, so it will break less

from relay-compiler-language-typescript.

sibelius avatar sibelius commented on August 27, 2024

we can relax ConcreteRequest types as they will keep changing and relay adds more transforms like @defer, @stream and so on

from relay-compiler-language-typescript.

artola avatar artola commented on August 27, 2024

@mattkrick is the "solution" to rollback this commit on typings?

DefinitelyTyped/DefinitelyTyped@f044c38#diff-03ed2ffcefe6022264efc0c0849fee14

I do believe that the compiler is a bit far from these typings.

from relay-compiler-language-typescript.

mattkrick avatar mattkrick commented on August 27, 2024

yeah, reverting for v1.3 is best. try keeping getRequest and just set it to any though.

I started v2 here: https://github.com/mattkrick/DefinitelyTyped/blob/v2.0/types/relay-runtime/index.d.ts
So much changed that I just started fresh. I ran flow-to-typescript over the whole thing & then made fixes where the conversion failed. still about 1 hour left to spend on it if anyone is itching to get it published feel free! (also i'm the worst with export syntax, feel free to let me know if there's a cleaner way!)

from relay-compiler-language-typescript.

alloy avatar alloy commented on August 27, 2024

Ok, closing this one. Looking forward to the typings for v2 and I expect to be able to pitch in on those again in another few weeks.

from relay-compiler-language-typescript.

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.