{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/20333","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/20333/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/20333/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/20333/events","html_url":"https://github.com/Microsoft/TypeScript/issues/20333","id":277857241,"number":20333,"title":"typescript.transpileModule crash when using e = [...(e || [])]; inside loop","user":{"login":"Meowtimer","id":322565,"avatar_url":"https://avatars1.githubusercontent.com/u/322565?v=4","gravatar_id":"","url":"https://api.github.com/users/Meowtimer","html_url":"https://github.com/Meowtimer","followers_url":"https://api.github.com/users/Meowtimer/followers","following_url":"https://api.github.com/users/Meowtimer/following{/other_user}","gists_url":"https://api.github.com/users/Meowtimer/gists{/gist_id}","starred_url":"https://api.github.com/users/Meowtimer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Meowtimer/subscriptions","organizations_url":"https://api.github.com/users/Meowtimer/orgs","repos_url":"https://api.github.com/users/Meowtimer/repos","events_url":"https://api.github.com/users/Meowtimer/events{/privacy}","received_events_url":"https://api.github.com/users/Meowtimer/received_events","type":"User","site_admin":false},"labels":[{"id":113970366,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21","default":false}],"state":"closed","locked":false,"assignee":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars3.githubusercontent.com/u/8000722?v=4","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"assignees":[{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars3.githubusercontent.com/u/8000722?v=4","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/56","html_url":"https://github.com/Microsoft/TypeScript/milestone/56","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/56/labels","id":2796126,"number":56,"title":"TypeScript 2.7","description":"","creator":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars3.githubusercontent.com/u/8000722?v=4","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"open_issues":172,"closed_issues":152,"state":"open","created_at":"2017-09-26T21:34:46Z","updated_at":"2017-12-02T03:51:14Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2017-11-29T18:20:27Z","updated_at":"2017-12-02T03:51:14Z","closed_at":"2017-12-02T03:51:14Z","author_association":"NONE","body":"\r\n**TypeScript Version:**  2.7.0-dev.20171129\r\n\r\n**Code**\r\n\r\nThe following code crashes the typescript.transpileModule API function.\r\n\r\n```ts\r\nfunction f() {\r\n  let e: {}[];\r\n  while (true) {\r\n    e = [...(e || [])];\r\n  }\r\n}\r\n```\r\n\r\n**Crash**\r\n```\r\nRangeError: Maximum call stack size exceeded\r\n    at checkIdentifier (node_modules/typescript/lib/typescript.js:35952:33)\r\n    at checkExpressionWorker (node_modules/typescript/lib/typescript.js:41475:28)\r\n    at checkExpression (node_modules/typescript/lib/typescript.js:41448:42)\r\n    at getTypeOfExpression (node_modules/typescript/lib/typescript.js:41419:58)\r\n    at getContextualTypeForBinaryOperand (node_modules/typescript/lib/typescript.js:36740:95)\r\n    at getContextualType (node_modules/typescript/lib/typescript.js:36956:28)\r\n    at getApparentTypeOfContextualType (node_modules/typescript/lib/typescript.js:36879:34)\r\n    at checkArrayLiteral (node_modules/typescript/lib/typescript.js:37092:34)\r\n    at checkExpressionWorker (node_modules/typescript/lib/typescript.js:41497:28)\r\n    at checkExpression (node_modules/typescript/lib/typescript.js:41448:42)\r\n```\r\n\r\nnode program to reproduce:\r\n```js\r\nrequire('typescript').transpileModule(\r\n`function f() {\r\n  let e: {}[];\r\n  while (true) {\r\n    e = [...(e || [])];\r\n  }\r\n}`,\r\n  {\r\n    compilerOptions: {},\r\n    fileName: 'test.ts'\r\n  }\r\n);\r\n```\r\n\r\n**Expected behavior:**\r\ntranspileModule transpiles the module.\r\n\r\n**Actual behavior:**\r\ntranspileModule crashes.\r\n"}}
{"actor":{"display_login":"mhegazy"}}