0

I have a TypeScript project that I push to Google Apps Scripts via clasp.

I'm using functions like Utilities.formatDate and const input = SpreadsheetApp.getUi().prompt('Paste the URL here.');.

I see errors like 'Utilities' is not defined. eslint(no-undef) and 'SpreadsheetApp' is not defined. eslint(no-undef).

I don't want to simply disable the no-undef rule.

How can I properly import those dependencies?


Docs:

https://developers.google.com/apps-script/reference/utilities/utilities#formatdatedate,-timezone,-format

https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#getui

Ryan
  • 22,332
  • 31
  • 176
  • 357
  • Did you install the types? – TheMaster Jul 07 '22 at 18:05
  • 1
    @TheMaster I had installed `"@types/google-apps-script": "^1.0.50",` in my `package.json` but `"types": ["google-apps-script"]` was what I was missing from my `tsconfig.json`. Thanks. https://stackoverflow.com/a/51772127/470749 – Ryan Jul 07 '22 at 18:15

0 Answers0