Giter Club home page Giter Club logo

Comments (14)

kastermester avatar kastermester commented on July 24, 2024

There's two kind of errors here:

  1. The typings for relay-runtime does not match what is expected
  2. 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.

alloy avatar alloy commented on July 24, 2024

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.

kastermester avatar kastermester commented on July 24, 2024

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.

alloy avatar alloy commented on July 24, 2024

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.

kastermester avatar kastermester commented on July 24, 2024

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.

alloy avatar alloy commented on July 24, 2024

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.

kastermester avatar kastermester commented on July 24, 2024

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.

alloy avatar alloy commented on July 24, 2024

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.

kastermester avatar kastermester commented on July 24, 2024

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.

alloy avatar alloy commented on July 24, 2024

Ah yes, good point. A comment that says that would be enough.

from relay-compiler-language-typescript.

kastermester avatar kastermester commented on July 24, 2024

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.

alloy avatar alloy commented on July 24, 2024

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.

kastermester avatar kastermester commented on July 24, 2024

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.

alloy avatar alloy commented on July 24, 2024

Sounds good 👍

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.