[英]How do I get ts2gas to emit ES6 code for Google Apps Script projects?
最近,Google Apps 腳本 (GAS) 改為在內部使用 V8。
我一直在使用VSCode 、 Typescript 、 Google Clasp和一個名為ts2gas的工具來開發 GAS 項目。
當前的工作流程將我的 ES6 源代碼的轉譯 ES3 版本上傳到 Google。
我要問的是:如何讓轉譯器開始輸出更多 V8 風格的代碼? 我有很多“const”和“let”,但編譯器總是將它們更改為“var”。 任何比 ES3 更新的東西都會被轉換為類似 ES3 的東西。 tsconfig.json
(例如)中是否有設置可以實現這一點?
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
).
在 ts2gas高級選項下,默認目標是“ES3”。 您可以將其更改為“ES6”,看看是否可以得到您想要的 output?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.