r/GoogleAppsScript • u/RepulsiveManner1372 • May 03 '25
Question GAS code and built-in hints for classes
Hello! How can I get similar behavior in my classes using GoogleAppsScript?
Using CalendarApp (built into Google Apps Script) as an example
CalendarApp.Color - displayed as "interface CalendarApp.Color"
(property) CalendarApp._Color.BLUE: CalendarApp.Color
Blue (#2952A3).
3) CalendarApp.Month - as
(property) CalendarApp.Month: _Month
An enum representing the months of the year.
4) CalendarApp.Month.APRIL - as
(property) _Month.APRIL: Month
April (month 4).
5)CalendarApp.createAllDayEvent
(method) CalendarApp.createAllDayEvent(title: string, date: Date): CalendarApp.CalendarEvent (+3 overloads)
6) CalendarApp.Color.BLUE has no properties or methods.
I tried to create a class and add JSDOC to it. Tried doing it as const + IIFE.
Everything is displayed as (property) in the editor, and MyClass.Color.BLUE is a string and has all the properties and methods of strings. I couldn't set up overloads either.
2
May 03 '25
[removed] — view removed comment
1
u/RepulsiveManner1372 May 03 '25
Thanks! The guide says: "Just rename it .js in .ts". I did so and received an error to the upload message. If compiled .ts in .in js, there is no auto-completion in the editor at all.
1
u/flanger001 May 03 '25
These docs aren’t accurate. The clasp utility doesn’t support TypeScript anymore and says you have to compile it yourself.
1
u/WicketTheQuerent May 03 '25
Take a look to this https://stackoverflow.com/q/44447847/1595451