Comments (10)
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.
@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.
Sure I can, but that's why I generate types. To use them.
from relay-compiler-language-typescript.
@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.
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:
- old (v1.6-ish?): https://github.com/facebook/relay/blob/fe0e70f10bbcba1fff89911313ea69f24569464b/packages/relay-runtime/util/RelayConcreteNode.js
- new (v2.0.0): https://github.com/facebook/relay/blob/master/packages/relay-runtime/util/RelayConcreteNode.js
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.
ConcreteRequest
will change very often, maybe it could be any
or unknow
, so it will break less
from relay-compiler-language-typescript.
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.
@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.
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.
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)
- Generated refetch definition with variables can not pass the validation of backend, such as github.com/vektah/gqlparser/v2
- Generate GraphQL fragment files for VSCode GraphQL Extension fragment autocompletion HOT 2
- Cannot read property 'createKeywordTypeNode' of undefined HOT 8
- Support for [email protected] HOT 8
- Migrate travis CI release process to GitHub actions HOT 3
- Unknown directive 'appendNode' HOT 1
- module esnext HOT 2
- Why is it not releasing HOT 7
- `require` substitution is not working HOT 6
- doc: explain why configuration with a single artifact directory is suggested
- Update to TS 4.4 and update types to support exactOptionalPropertyTypes HOT 1
- @stream argument naming by schema spec is: `initialCount` not `initial_count` HOT 1
- Invalid AST Node error with graphql@16 HOT 2
- Typescript 4.5 type generation is broken HOT 6
- Relay Compiler generates Typescript Synthax error HOT 3
- Error: Cannot find module 'relay-compiler-language-typescript' on 15.0
- Fragment Typematching
- Input Types generated as readonly HOT 1
- deprecate this package HOT 1
- Issue with import of the __generated__
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from relay-compiler-language-typescript.