{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6737","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6737/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6737/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6737/events","html_url":"https://github.com/Microsoft/TypeScript/issues/6737","id":129892118,"number":6737,"title":"1.8 breaks use of third-party promise libraries","user":{"login":"bytenik","id":441347,"avatar_url":"https://avatars.githubusercontent.com/u/441347?v=3","gravatar_id":"","url":"https://api.github.com/users/bytenik","html_url":"https://github.com/bytenik","followers_url":"https://api.github.com/users/bytenik/followers","following_url":"https://api.github.com/users/bytenik/following{/other_user}","gists_url":"https://api.github.com/users/bytenik/gists{/gist_id}","starred_url":"https://api.github.com/users/bytenik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bytenik/subscriptions","organizations_url":"https://api.github.com/users/bytenik/orgs","repos_url":"https://api.github.com/users/bytenik/repos","events_url":"https://api.github.com/users/bytenik/events{/privacy}","received_events_url":"https://api.github.com/users/bytenik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"rbuckton","id":3902892,"avatar_url":"https://avatars.githubusercontent.com/u/3902892?v=3","gravatar_id":"","url":"https://api.github.com/users/rbuckton","html_url":"https://github.com/rbuckton","followers_url":"https://api.github.com/users/rbuckton/followers","following_url":"https://api.github.com/users/rbuckton/following{/other_user}","gists_url":"https://api.github.com/users/rbuckton/gists{/gist_id}","starred_url":"https://api.github.com/users/rbuckton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbuckton/subscriptions","organizations_url":"https://api.github.com/users/rbuckton/orgs","repos_url":"https://api.github.com/users/rbuckton/repos","events_url":"https://api.github.com/users/rbuckton/events{/privacy}","received_events_url":"https://api.github.com/users/rbuckton/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/19","html_url":"https://github.com/Microsoft/TypeScript/milestones/TypeScript%201.8.2","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/19/labels","id":1549707,"number":19,"title":"TypeScript 1.8.2","description":"","creator":{"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},"open_issues":10,"closed_issues":3,"state":"open","created_at":"2016-01-28T19:01:30Z","updated_at":"2016-01-29T23:33:33Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-01-29T21:50:30Z","updated_at":"2016-01-29T23:36:27Z","closed_at":null,"body":"I'm currently developing in TS 1.7, compiling to ES6, and transpiling with Babel to ES5. I use Angular 1.x for my frontend development currently.\r\n\r\nI am able to leverage async functions by returning a custom type, `QPromise`, for which I've written a definition like this:\r\n\r\n```\r\ndeclare class QPromise<T> implements angular.IPromise<T> {\r\n    constructor(resolver: (resolve: angular.IQResolveReject<T>, reject: angular.IQResolveReject<any>) => any);\r\n    then<TResult>(successCallback: (promiseValue: T) => angular.IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): angular.IPromise<TResult>;\r\n    catch<TResult>(onRejected: (reason: any) => angular.IPromise<TResult>|TResult): angular.IPromise<TResult>;\r\n    finally(finallyCallback: () => any): angular.IPromise<T>;\r\n}\r\n```\r\n\r\nI then create a JavaScript file with a definition QPromise:\r\n\r\n```\r\nfunction QPromise(resolver) {\r\n    var $q = angular.injector(['ng']).get(\"$q\");\r\n    return new $q(resolver);\r\n};\r\n```\r\n\r\nWhile less than elegant, this has been an acceptable shim for now so that I can use async while still using Angular's $q library, which is needed to get Angular digest to occur automatically.\r\n\r\nTS 1.8 no longer lets me return a `QPromise<T>`, complaining: `error TS1064: The return type of an async function or method must be the global Promise<T> type.`\r\n\r\nThis all but breaks my ability to work with Angular 1 and still use TS async functions."},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/177018536","html_url":"https://github.com/Microsoft/TypeScript/issues/6737#issuecomment-177018536","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/6737","id":177018536,"user":{"login":"bytenik","id":441347,"avatar_url":"https://avatars.githubusercontent.com/u/441347?v=3","gravatar_id":"","url":"https://api.github.com/users/bytenik","html_url":"https://github.com/bytenik","followers_url":"https://api.github.com/users/bytenik/followers","following_url":"https://api.github.com/users/bytenik/following{/other_user}","gists_url":"https://api.github.com/users/bytenik/gists{/gist_id}","starred_url":"https://api.github.com/users/bytenik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bytenik/subscriptions","organizations_url":"https://api.github.com/users/bytenik/orgs","repos_url":"https://api.github.com/users/bytenik/repos","events_url":"https://api.github.com/users/bytenik/events{/privacy}","received_events_url":"https://api.github.com/users/bytenik/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T23:36:27Z","updated_at":"2016-01-29T23:36:27Z","body":"What's the logic behind the change away from allowing any `new`able `PromiseLike` promise type anyway?"}}