1
votes

Recently Google Apps Script (GAS) changed over to using V8 internally.

I've been using VSCode, Typescript, Google Clasp and a tool called ts2gas to develop GAS projects.

The current workflow uploads a transpiled ES3 version of my ES6 source code to Google.

What I'm asking is this: how do I get the transpiler to start outputting more V8-ish code? I have lots of "const" and "let" but the transpiler invariably changes them to "var". Anything that is more recent than ES3 gets converted to an ES3 workalike. Are there settings in tsconfig.json (for example) that will make this happen?

2

2 Answers

2
votes

According to the documentation (README.MD) in the clasp github repo, you need to set the target property to 2019 in tsconfig.json and ensure that the v8 runtime is enabled for your apps script project (in appscript.json).

1
votes

Under ts2gas advanced options the default target is 'ES3'. You could change that to 'ES6' and see if that works to get the output you want?