does any have a view on Typescript vs JS ES6 for t...
# prisma-whats-new
m
does any have a view on Typescript vs JS ES6 for the Graphcool serverless functions? I've seen many of the official templates are in TS
s
Yeah, I was hoping to have ES6 as well
I donโ€™t plan on moving to TS
An odd move for sure
m
@senorcodecat You can use ES6 and it's no problem. I've already been using across most of my functions
s
Oh, I have been
Just curious as to why the templates are now TS
m
oh okay. yeah me too. thinking about it makes sense though because the type checking makes them more robust
m
I wanted to know if graphcool considers the use of TypeScript to be best practise
Thanks Kim @agartha
I take it you're using TS?
a
The answer to that question is mostly a matter of taste. You can use anything that transpiles to JS. Typescript, Coffeescript, Clojure, Reason, etc. etc. etc.
You can also deploy your own functions (for example to AWS) and get Python support.
@max Yes, I am using TS
m
@agartha Does you know about [TypeScript] Checking event.context.auth when youโ€™re also defining EventData? https://www.graph.cool/forum/t/typescript-checking-event-context-auth-when-youre-also-defining-eventdata/1878
It's my first day using TS for my gc funcs
๐Ÿ™‚
a
That contains all the types you need for
event
Basically, if you use
FunctionEvent<EventData>
you already have a strongly typed context because of
FunctionEvent
m
So Context is already defined because EventData extends FunctionEvent?
@agartha thanks for that - super helpful ๐Ÿ™‚
I updated the forum post with your answer ๐Ÿ™‚
๐Ÿ‘๐Ÿป 1
i
If you want to use JavaScript, simply compile your TypeScript and refactor