Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Change script file extension in Apps Script online IDE

I’ve created a script using Apps Script in Google Sheets, and would like to code in TypeScript. I gather to do this you need to rename the default .gs file to .ts.

How does one accomplish that in the online IDE? It doesn’t seem to let you rename the extension:

Animation showing a rename attempt from Code.js to Code.ts producing Code.ts.js

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I tried the "classic editor" with similar results. I don’t want to install Node (which requires Administrator privileges) and CLASP (which requires granting access to my Google account) just to rename a file!

There are hints the online editor supports TypeScript (e.g. autocomplete lists parameter types):

Example of autocomplete showing typed parameters

But if I try creating typed variables or parameters in my .gs file I get linter and syntax errors:

let foo:string = 'hello';

Syntax error Unexpected token ':'

>Solution :

Typescript is currently not supported in Apps script editor. There is however, a feature request for the same here: https://issuetracker.google.com/issues/238057231

You may add a +1 or comment in the tracker explaining benefits from a business point of view, if you’re interested.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading