graphcool-templates
graphcool-templates copied to clipboard
Templates should be written in TypeScript
Issue type:
I am submitting:
- [ ] an issue
- [x] a feature request
What feature would you like to see added? Please be descriptive.
I would like to see all examples to be written in TypeScript to encourage people to adopt it. It makes a lot of sense to write resolvers in TS since it would help make them more robust and less bug prone.
Would you be able to submit a PR for this yourself?
Yes, I might be able to contribute to some of them.
I would like to see multiple language branches, so Graphcool templates are also easily accessible to vanilla JS developers. http://githut.info/ Typescript is still in place 34 on Github, versus Javascript in place 1...
Sure, I wouldn't mind if they existed in both JavaScript and TypeScript. If you write them in TS you can easily convert them to JS. It's much more of a hassle to do the opposite for obvious reasons.
So, should we just have separate examples for TypeScript or should they reside in the same examples (probably not supported atm)?
^ Maybe a win-win could be setting up a tsconfig.json
and transpiling (in a pre-commit
hook) the TS to JS. There would still have to be a bit of refactoring but it would, for the most part, be the same. I agree that it's a LOT easier for developers to transpile TS to JS instead of the other way around.
As someone who no TypeScript when I started, the templates in TS were simple and easy to follow. I easily striped out the TS when I reused the code for other functions :)