{"action":"opened","issue":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/30400","repository_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped","labels_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/30400/labels{/name}","comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/30400/comments","events_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/30400/events","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30400","id":379019044,"node_id":"MDU6SXNzdWUzNzkwMTkwNDQ=","number":30400,"title":"google-apps-script: A mistyped? type","user":{"login":"aiya000","id":4897842,"node_id":"MDQ6VXNlcjQ4OTc4NDI=","avatar_url":"https://avatars2.githubusercontent.com/u/4897842?v=4","gravatar_id":"","url":"https://api.github.com/users/aiya000","html_url":"https://github.com/aiya000","followers_url":"https://api.github.com/users/aiya000/followers","following_url":"https://api.github.com/users/aiya000/following{/other_user}","gists_url":"https://api.github.com/users/aiya000/gists{/gist_id}","starred_url":"https://api.github.com/users/aiya000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aiya000/subscriptions","organizations_url":"https://api.github.com/users/aiya000/orgs","repos_url":"https://api.github.com/users/aiya000/repos","events_url":"https://api.github.com/users/aiya000/events{/privacy}","received_events_url":"https://api.github.com/users/aiya000/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-09T04:29:43Z","updated_at":"2018-11-09T04:29:43Z","closed_at":null,"author_association":"NONE","body":"If you know how to fix the issue, make a pull request instead.\r\n\r\n- [x] I tried using the `@types/google-apps-script` package and had problems.\r\n- [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript\r\n- [x] I have a question that is inappropriate for [StackOverflow](https://stackoverflow.com/).  (Please ask any appropriate questions there).\r\n- [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see `Definitions by:` in `index.d.ts`) so they can respond.\r\n  - Authors: @motemen, @grant\r\n\r\n- - -\r\n\r\nIf you do not mention the authors the issue will be ignored.\r\n\r\nHello :smiley:\r\n\r\nI'm developping a google apps script, and found an issue.\r\n\r\nBelow code raises an error.\r\n\r\n(\"a specified attribute's value is invalid: payload\")\r\n\r\n```typescript\r\nfunction requestAimlWithSheets() {\r\n    const response = UrlFetchApp.fetch(\"https://httpbin.org/anything\", {\r\n        method: \"put\",\r\n        payload: ['poi'],\r\n    })\r\n    Logger.log(response.getContent())\r\n}\r\n```\r\n\r\nBut below raises no errors.\r\n\r\n```typescript\r\n    const response = UrlFetchApp.fetch(\"https://httpbin.org/anything\", {\r\n        method: \"put\",\r\n        payload: 'poi',  // string!\r\n    })\r\n```\r\n\r\n```typescript\r\n    const response = UrlFetchApp.fetch(\"https://httpbin.org/anything\", {\r\n        method: \"put\",\r\n        payload: JSON.stringify(['poi']),  // string!\r\n    })\r\n```\r\n\r\nAlso [the official document](https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app#fetch) doesn't say 'payload' can be an `object` :thinking:\r\n\r\nMaybe @types/google-apps-script needs below.\r\n\r\n```diff\r\ndiff --git a/types/google-apps-script/google-apps-script-tests.ts b/types/google-apps-script/google-apps-script-tests.ts\r\nindex a6a3ac8437..e564254d8a 100644\r\n--- a/types/google-apps-script/google-apps-script-tests.ts\r\n+++ b/types/google-apps-script/google-apps-script-tests.ts\r\n@@ -28,11 +28,11 @@ CalendarApp.GuestStatus.NO;\r\n \r\n // test for URLFetchRequestOptions.payload\r\n import URLFetchRequestOptions = GoogleAppsScript.URL_Fetch.URLFetchRequestOptions;\r\n-const postTest = (payload: Object): string => {\r\n+const postTest = (payload: string): string => {\r\n   const url = 'http://httpbin.org/post';\r\n   const params: URLFetchRequestOptions = {\r\n     method: 'post',\r\n     payload: payload\r\n   };\r\n   return UrlFetchApp.fetch(url, params).getContentText();\r\n };\r\ndiff --git a/types/google-apps-script/google-apps-script.url-fetch.d.ts b/types/google-apps-script/google-apps-script.url-fetch.d.ts\r\nindex 28cc744672..05a5a27b64 100644\r\n--- a/types/google-apps-script/google-apps-script.url-fetch.d.ts\r\n+++ b/types/google-apps-script/google-apps-script.url-fetch.d.ts\r\n@@ -48,7 +48,7 @@ declare namespace GoogleAppsScript {\r\n        * payload. It can be a string, a byte array, or a JavaScript object. A JavaScript object will be\r\n        * interpretted as a map of form field names to values, where the values can be either strings or blobs.\r\n        */\r\n-      payload?: string | object | Base.Blob;\r\n+      payload?: string | Base.Blob;\r\n \r\n       /**\r\n        * Deprecated. This instructs fetch to resolve the specified URL within the intranet linked to your\r\n```\r\n"}}
{"actor":{"display_login":"aiya000"}}