0

I am using VSCode to edit Google App Script (GAS) code with clasp. I have intellisense working for the core libraries just fine.

(This post helped)

However, I am also using a Firestore library in the ScriptApp project and intellisense is not working for the FirestoreApp.

I've tried included the library Javascript code in my project directory and also in the node_modules directory - but no luck.

Does anyone have any tips? Thanks.

TheMaster
  • 45,448
  • 6
  • 62
  • 85
  • 1
    You'll need type definitions file for that library just like https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/google-apps-script/google-apps-script.spreadsheet.d.ts found in https://www.npmjs.com/package/@types/google-apps-script If there isn't any available, you'll create one defining the types. – TheMaster Mar 06 '19 at 09:40
  • No such file in the library to date. Will I have to create a TypeScript file that has an interface defined for each of the objects and functions in the library? – Mike McClure Mar 06 '19 at 21:46
  • Yes`````````.````````` – TheMaster Mar 06 '19 at 21:49
  • Thanks. I'll reach out to the library owner first though... – Mike McClure Mar 07 '19 at 03:11

1 Answers1

0

For 3rd Party Libraries, like FirestoreApp, autocompletion does not work.

You will need to create your own .d.ts files (optionally added to DefinitelyTyped).

Another option would be to copy/paste the library into your script, and editors like VS Code will provide light autocompletion (1 level deep). The code doesn't need to be in the node_modules directory.

Grant Timmerman
  • 414
  • 5
  • 9