{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/12917","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/12917/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/12917/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/12917/events","html_url":"https://github.com/Microsoft/TypeScript/issues/12917","id":195605118,"number":12917,"title":"AllowJS breaks module imports","user":{"login":"servermeta","id":7604623,"avatar_url":"https://avatars.githubusercontent.com/u/7604623?v=3","gravatar_id":"","url":"https://api.github.com/users/servermeta","html_url":"https://github.com/servermeta","followers_url":"https://api.github.com/users/servermeta/followers","following_url":"https://api.github.com/users/servermeta/following{/other_user}","gists_url":"https://api.github.com/users/servermeta/gists{/gist_id}","starred_url":"https://api.github.com/users/servermeta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servermeta/subscriptions","organizations_url":"https://api.github.com/users/servermeta/orgs","repos_url":"https://api.github.com/users/servermeta/repos","events_url":"https://api.github.com/users/servermeta/events{/privacy}","received_events_url":"https://api.github.com/users/servermeta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-14T18:13:00Z","updated_at":"2016-12-14T21:15:54Z","closed_at":null,"body":"<!-- BUGS: Please use this template. -->\r\n<!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n<!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:**  2.1.1 / nightly (2.2.0-dev.201xxxxx)\r\n\r\n**Code**\r\n\r\n```ts\r\nimport * as google from 'googleapis';\r\n```\r\n\r\n**Expected behavior:** Without allowjs everything is fine. With allowjs as true, it should behave the same.\r\n\r\n**Actual behavior:**\r\nWhen allowjs is set to true, module import breaks. \r\n\r\n```\r\nsrc/index.ts(41,36): error TS2339: Property 'auth' does not exist on type 'Function'.\r\nsrc/index.ts(247,34): error TS2339: Property 'sheets' does not exist on type 'Function'.\r\n```\r\n\r\nI tried to declare the module, but it doesn't prevent from breaking."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/267158830","html_url":"https://github.com/Microsoft/TypeScript/issues/12917#issuecomment-267158830","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/12917","id":267158830,"user":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars.githubusercontent.com/u/8000722?v=3","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},"created_at":"2016-12-14T21:15:54Z","updated_at":"2016-12-14T21:15:54Z","body":"A few notes:\r\n\r\n- why are you using `--allowjs` if i may ask? do you have `.js` files in your project or is it for the import?\r\n- i can not really tell what the errors mean without having the file, so please include a *self-contained* sample for us to debug against\r\n- the error for a missing module should not be shown in TS 2.1, but it is because the `package.json`::`main` field points to a file with no extension `'./lib/googleapis'`, and the compiler can not find this file on disk. this is a bug and should be fixed, this would make the error go away.\r\n- in general the recommendation for cases like these is to declare the module yourself, since there is no declaration file available at Definitely Typed. the simplest declaration file would look like:\r\n\r\n```ts\r\n// modules.d.ts\r\n\r\ndeclare module \"googleapis\";\r\n```\r\n"}}
{"actor":{"display_login":"mhegazy"}}