Comments (14)
There's two kind of errors here:
- The typings for relay-runtime does not match what is expected
- When we need to "import" a type and cannot (due to the relative path stuff we disabled) we still need a name for that type. The flow stuff works by simply declaring a type that is aliased to
any
.
I will look into number 2.
from relay-compiler-language-typescript.
Yup. The ones described in 1 are already in this PR alloy/DefinitelyTyped#1, but that PR first still needs to be amended based on your approach. Will you send a PR for that as well?
from relay-compiler-language-typescript.
I can yes - what about the names for the special properties used to make the type system work. Any changes we should make here?
The names are arbitrary no matter what we do I'd say - so its tough to say which ones would be best I think?
from relay-compiler-language-typescript.
Ah yes, good point. I initially went with something like *_ref
as well, but after integrating it into one of our apps I didn’t quite like the aesthetic of it and found the way it’s done in the upstream Flow typings somewhat nicer to read, the $
immediately makes it clear that these are special things.
from relay-compiler-language-typescript.
I think naming the ref types with $ is fine. I was more thinking about the property names. I quite like the idea of getting them out of the auto completion list, perhaps we should just name them the same as they do in the flow implementation, but with a whitespace prefixed?
from relay-compiler-language-typescript.
Oh yes yes, I absolutely agree with keeping them out of the auto-completion list!
Just out of curiosity, do you know if it’s documented behaviour or could it just be a TS language server/VS Code bug?
from relay-compiler-language-typescript.
I can't remember where I first saw it mentioned, but I would be surprised if it is documented - but I can try and look at the TS source code to see if it seems intentional.
from relay-compiler-language-typescript.
I would be nice to have link to leave in a comment next to the code that generates the property name, but I’m ok with using undocumented behaviour too 👍
from relay-compiler-language-typescript.
I have some trouble finding the exact code in the repo, as it is quite large. However, it does kinda make sense that they exclude properties whose names aren't valid JS identifiers.
from relay-compiler-language-typescript.
Ah yes, good point. A comment that says that would be enough.
from relay-compiler-language-typescript.
I will try to work on the PR for DT. I need to figure out how to deal with array types in the code for it. The flow type definitions do a bit with it, so I'll try to decipher that and see if I can replicate it for TS.
from relay-compiler-language-typescript.
Not sure it helps with the situation you’re thinking of, but just in case this might be helpful https://twitter.com/kassens/status/946810603875729408
from relay-compiler-language-typescript.
I think we can close this for now? As far as I know we just have better typings to create (missing classic types as well as the awaitings of TS 2.8).
from relay-compiler-language-typescript.
Sounds good 👍
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.