Is there a type definition for the doGet/doPost trigger function event object?

后端 未结 1 570
情书的邮戳
情书的邮戳 2021-01-14 10:45

I am trying to turn a Google Script into a Web App, using CLASP.

Is there an existing type definition for the "e" object in doGet(e) / do

相关标签:
1条回答
  • 2021-01-14 11:26

    Update:

    Latest definitions include events. You may use events like this:

    function doGet(e: GoogleAppsScript.Events.DoGet){
    

    Events seem to be in the works. It doesn't have webapps doget event yet. In the mean time, You can install the latest type(@types/google-apps-script@latest) and add the following interface in the Events module inside google-apps-script-events.d.ts

      export interface WebAppsDoGet { //should be inside module Events
        queryString: string,
        parameter: {[key: string]: string; },
        contextPath: string,
        parameters: {
         [key: string]: string[]; },
        contentLength: number
      }
    

    You can then use it like this:

    function doGet(e: GoogleAppsScript.Events.WebAppsDoGet){
    
    0 讨论(0)
提交回复
热议问题