{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2149","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2149/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2149/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2149/events","html_url":"https://github.com/Microsoft/TypeScript/issues/2149","id":59050980,"number":2149,"title":"Define variable to match declared variable with 'new'","user":{"login":"NN---","id":580536,"avatar_url":"https://avatars.githubusercontent.com/u/580536?v=3","gravatar_id":"","url":"https://api.github.com/users/NN---","html_url":"https://github.com/NN---","followers_url":"https://api.github.com/users/NN---/followers","following_url":"https://api.github.com/users/NN---/following{/other_user}","gists_url":"https://api.github.com/users/NN---/gists{/gist_id}","starred_url":"https://api.github.com/users/NN---/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NN---/subscriptions","organizations_url":"https://api.github.com/users/NN---/orgs","repos_url":"https://api.github.com/users/NN---/repos","events_url":"https://api.github.com/users/NN---/events{/privacy}","received_events_url":"https://api.github.com/users/NN---/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-02-26T10:24:05Z","updated_at":"2015-02-26T21:04:04Z","closed_at":"2015-02-26T14:31:52Z","body":"It is possible to define variable with declared when the function name is not 'new'\r\n\r\n```typescript\r\ninterface X {\r\n}\r\ndeclare var X: {\r\n    f(): X;\r\n}\r\n\r\n// OK, compatible type\r\nvar X = {\r\n\tf() { return <X>null; }\r\n};\r\n\r\n\r\ninterface Y {\r\n}\r\ndeclare var Y: {\r\n    new(): Y;\r\n}\r\n\r\n// Not compatible types\r\n// new() : Y vs. new() => Y\r\nvar Y = {\r\n\tnew() { return <Y>null; }\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/76272994","html_url":"https://github.com/Microsoft/TypeScript/issues/2149#issuecomment-76272994","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2149","id":76272994,"user":{"login":"NN---","id":580536,"avatar_url":"https://avatars.githubusercontent.com/u/580536?v=3","gravatar_id":"","url":"https://api.github.com/users/NN---","html_url":"https://github.com/NN---","followers_url":"https://api.github.com/users/NN---/followers","following_url":"https://api.github.com/users/NN---/following{/other_user}","gists_url":"https://api.github.com/users/NN---/gists{/gist_id}","starred_url":"https://api.github.com/users/NN---/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NN---/subscriptions","organizations_url":"https://api.github.com/users/NN---/orgs","repos_url":"https://api.github.com/users/NN---/repos","events_url":"https://api.github.com/users/NN---/events{/privacy}","received_events_url":"https://api.github.com/users/NN---/received_events","type":"User","site_admin":false},"created_at":"2015-02-26T21:04:04Z","updated_at":"2015-02-26T21:04:04Z","body":"Unfortunately this doesn't work.\r\nIt works with explicit cast, is it a bug ?\r\n\r\n```typescript\r\ninterface QQ {\r\n}\r\n\r\ndeclare var QQ:{\r\n    new(): QQ;\r\n}\r\n\r\nclass QQImpl {\r\n\tconstructor() {}\r\n}\r\n\r\nvar QQ = QQImpl; // Doesn't work \r\n\r\n// But works with explicit cast !\r\nvar QQ = <{new():QQ;}> QQImpl;\r\n```"}}