代码之家  ›  专栏  ›  技术社区  ›  Dustin Michels

Google Script Web App/Clasp:doGet(e)中“e”的类型定义?

  •  0
  • Dustin Michels  · 技术社区  · 7 年前

    我正在尝试将谷歌脚本转换为 Web App ,使用钩子。

    中是否存在“e”对象的现有类型定义 doGet(e) / doPost(e) 我可以用在东西的打字/钩边吗?

    0 回复  |  直到 6 年前
        1
  •  7
  •   TheMaster    6 年前

    更新:

    Latest definitions 包括 events . 您可以使用以下事件:

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

    Events 似乎在 works .它还没有webapps doget活动。同时,你可以安装最新的类型(@types/google apps)-script@latest)并在google apps脚本事件中的事件模块中添加以下界面。d、 ts

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

    然后你可以这样使用它:

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