Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript support #77

Closed
grant opened this issue Mar 24, 2018 · 4 comments
Closed

TypeScript support #77

grant opened this issue Mar 24, 2018 · 4 comments

Comments

@grant
Copy link
Contributor

grant commented Mar 24, 2018

Expected Behavior

You should be able to code Apps Script locally with autocompleting types. This is the main advantage of using script.google.com IMO.

Actual Behavior

You can use clasp to download/upload projects, but it's not feasible to develop Apps Script locally.

Implementation

Transpile all ts files clasp push.

var ts = require('typescript');
// https://www.typescriptlang.org/docs/handbook/compiler-options.html
var t = ts.transpile(s, {
  // strict: true,
  target: 'ES3',
  lib: ["es2015"],
  // removeComments: true,
});

Caveat: You can't clasp pull to update ts files, but we're moving away the Apps Script editor anyways.

@grant grant mentioned this issue Mar 24, 2018
11 tasks
@grant
Copy link
Contributor Author

grant commented Apr 12, 2018

Provide a guide like this:
https://firebase.google.com/docs/functions/typescript

@FiloSottile
Copy link

You can get very good TypeScript support by installing types and compiling before pushing. https://blog.filippo.io/gmail-bot-with-apps-script-and-typescript/

@gauntface
Copy link

It would be great if this could be officially supported with types provided by the appscript / clasp team.

@grant
Copy link
Contributor Author

grant commented Jul 19, 2018

TypeScript is supported with clasp@1.5 🎉

The supported types are at @types/google-apps-script. I'll update that package with updated Apps Script types every so often.

Please report issues with the types in the types source code: https://github.com/DefinitelyTyped/DefinitelyTyped

Closing as fixed.

@grant grant closed this as completed Jul 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants