{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4140","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4140/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4140/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4140/events","html_url":"https://github.com/Microsoft/TypeScript/issues/4140","id":98887215,"number":4140,"title":"Can't define variable using type of typeof","user":{"login":"jabbukka","id":6121185,"avatar_url":"https://avatars.githubusercontent.com/u/6121185?v=3","gravatar_id":"","url":"https://api.github.com/users/jabbukka","html_url":"https://github.com/jabbukka","followers_url":"https://api.github.com/users/jabbukka/followers","following_url":"https://api.github.com/users/jabbukka/following{/other_user}","gists_url":"https://api.github.com/users/jabbukka/gists{/gist_id}","starred_url":"https://api.github.com/users/jabbukka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jabbukka/subscriptions","organizations_url":"https://api.github.com/users/jabbukka/orgs","repos_url":"https://api.github.com/users/jabbukka/repos","events_url":"https://api.github.com/users/jabbukka/events{/privacy}","received_events_url":"https://api.github.com/users/jabbukka/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Question","name":"Question","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-08-04T04:37:39Z","updated_at":"2015-08-07T15:53:20Z","closed_at":"2015-08-07T15:53:14Z","body":"I declared `test` module to export the global mongoose variable as below.\r\ntest1.d.ts:\r\n```javascript\r\n  declare module \"test\" {\r\n    import _mongoose = require('mongoose');\r\n    export var export_mongoose: typeof _mongoose;\r\n  }\r\n```\r\n\r\nI tried to define mongoose.Model using the export_mongoose variable. Please refer to below code:\r\ntest2.ts:\r\n```javascript\r\n  /// \\<reference path=\"test1.d.ts\" /\\>\r\n  import test = require('test');\r\n  var model: test.export_mongoose.Model\\<number\\>;  // it doesn't work.\r\n  var model = test.export_mongoose;  // it works well.\r\n```\r\n\r\nHowever, tsc compiler shows a following error message:\r\n  TS2305: Module `test` has no exported member `export_mongoose`.\r\n\r\nI think the export_mongoose is not proper as type cause defined by `typeof`.\r\nCan I use the `export_mongoose` as type?\r\n\r\nIt would be helpful for me if you have any idea on this.\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/128745448","html_url":"https://github.com/Microsoft/TypeScript/issues/4140#issuecomment-128745448","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4140","id":128745448,"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":"2015-08-07T15:53:20Z","updated_at":"2015-08-07T15:53:20Z","body":"glad that helped."}}