graphcool-templates icon indicating copy to clipboard operation
graphcool-templates copied to clipboard

Templates should be written in TypeScript

Open mekwall opened this issue 7 years ago • 4 comments

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.

mekwall avatar Nov 06 '17 12:11 mekwall

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...

kbrandwijk avatar Nov 06 '17 13:11 kbrandwijk

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)?

mekwall avatar Nov 08 '17 11:11 mekwall

^ 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.

iamclaytonray avatar Nov 23 '17 11:11 iamclaytonray

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 :)

maxdarque avatar Dec 13 '17 22:12 maxdarque