-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript support #6
Comments
Thanks for the suggestion, but not being typed is an intentional differentiation from Relay and Apollo. We won't use TypeScript here for a few reasons:
My intention is to only reduce the code we have now, and never exceed around 1-2 KB source. JSDoc is manageable at this scale and documentation.js is working well to keep the API in the readme up to date. Where possible I strip transpilation from projects once Node.js and browsers are able to handle the APIs and language features used natively. Once IE11 dies off a lot will change fast. Everyone should be working towards a native, standards based web and I don't believe in TypeScript as a permanent fixture. |
Thanks for your detailed explanation, at least now I know I can safely ignore this project ;) I am not going to try to convince you, but I think you are kinda biased against TypeScript right now, so I will just leave a few pointers. I would like to you invite to read my recent article about TypeScript.
Frankly, I couldn't work anymore without TypyScript telling me the result of my queries or what variables are required for a mutation. You can never achieve that level of conveniece with JSDoc. |
Just came to see if this package is written in TS and was pleasantly surprised it's not. @jaydenseric I share all your thoughts, contributing to a TS project (even a small one) and reading its source code is a hell for non-TS person. I'll definitely give this package a shot next project instead of apollo. Huge 👍 from me for your choices. |
@jaydenseric But you can write code in javascript. For the support typescript is needed only add d.ts file. |
@jaydenseric I share your reasoning - I avoid Typescript in my projects so I welcome your decision to avoid Typescript here! :-) |
Types are now available by adding the |
Also, just to be clear, I am completely in agreement with the decision to keep this codebase in I'm frustrated by the explosion of brittle, cobbled-together build systems acting as gate keepers to open source projects. Adding these definitions to the DefinitelyTyped repo was just excruciating, and epitomized the pain points described above. All that said, I did write definitions for a project and figured I should share them. |
Thanks for the the typings @mike-marcacci! Am I missing something or is there no type information for |
Ah I see. It's |
This situation has changed considerably since 2018, now it's possible to support TypeScript (cutting-edge versions at least) via TypeScript flavoured JSDoc comments within
Unfortunately, using the TypeScript flavour of JSDoc means the API docs in the readme can no longer be automatically generated using Because there are 30 exported modules, it might not be worth the effort to repeat by hand in the readme markdown the documentation already available by reading the source code JSDoc comments or using intellisense. In that case, we might just list in the readme the exported modules and skip documenting their contents. |
I am curious if it's planned? From my experience, it is so much easier to have a project written in Typescript instead of creating ad-hoc typings and maintaining those (same way as react-apollo does it).
It's not a problem to use
.mjs
, the TypeScript is able to emit full ESM module, although it will be with.js
extension so there would need to be an extra step of renaming those, but that should be easy.The text was updated successfully, but these errors were encountered: