Title: Incorrect return types for Promise#catch and 0- and 2- arg forms of Promise#then · Issue #9193 · microsoft/TypeScript · GitHub
Open Graph Title: Incorrect return types for Promise#catch and 0- and 2- arg forms of Promise#then · Issue #9193 · microsoft/TypeScript
X Title: Incorrect return types for Promise#catch and 0- and 2- arg forms of Promise#then · Issue #9193 · microsoft/TypeScript
Description: Expression (p: Promise) Correct type Current type p.then() Promise Promise<{}> p.then(b => 1) Promise Promise p.then(b => 1, e => 'error') Promise
Open Graph Description: Expression (p: Promise) Correct type Current type p.then() Promise Promise<{}> p.then(b => 1) Promise Promise p.then(b => 1, e => 'error') Promise X Description: Expression (p: Promise) Correct type Current type p.then() Promise Promise<{}> p.then(b => 1) Promise Promise p.then(b => 1, e => 'error') Promise<number string> p.then...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9193
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect return types for Promise#catch and 0- and 2- arg forms of Promise#then","articleBody":"| Expression (p: Promise\u003cboolean>) | Correct type | Current type |\n| --- | --- | --- |\n| p.then() | Promise\u003cboolean> | Promise\u003c{}> |\n| p.then(b => 1) | Promise\u003cnumber> | Promise\u003cnumber> |\n| p.then(b => 1, e => 'error') | Promise\u003cnumber | string> | Promise\u003cnumber> |\n| p.then(b => 1, e => {}) | Promise\u003cnumber | void> | Promise\u003cnumber> |\n| p.then(b => 1, e => {throw Error()}) | Promise\u003cnumber> | Promise\u003cnumber> |\n| p.then(b => 1, e => Promise.reject(Error())) | Promise\u003cnumber> | Promise\u003cnumber> |\n| p.catch(e => 'error') | Promise\u003cboolean | string> | Promise\u003cboolean> |\n| p.catch(e => {}) | Promise\u003cboolean | void> | Promise\u003cboolean> |\n| p.catch(e => {throw Error()}) | Promise\u003cboolean> | Promise\u003cboolean> |\n| p.catch(e => Promise.reject(Error())) | Promise\u003cboolean> | Promise\u003cboolean> |\n\nUsing overloading and the new `never` type, PromiseLike/Promise could be typed to handle all these cases correctly:\n\n``` ts\ninterface PromiseLike\u003cT> {\n then(): PromiseLike\u003cT>;\n then\u003cR1>(onfulfilled: (value: T) => R1 | PromiseLike\u003cR1>): PromiseLike\u003cR1>;\n then\u003cR1, R2>(onfulfilled: (value: T) => R1 | PromiseLike\u003cR1>,\n onrejected: (reason: any) => R2 | PromiseLike\u003cR2>): PromiseLike\u003cR1 | R2>;\n}\n\ninterface Promise\u003cT> {\n then(): Promise\u003cT>;\n then\u003cR1>(onfulfilled: (value: T) => R1 | PromiseLike\u003cR1>): Promise\u003cR1>;\n then\u003cR1, R2>(onfulfilled: (value: T) => R1 | PromiseLike\u003cR1>,\n onrejected: (reason: any) => R2 | PromiseLike\u003cR2>): Promise\u003cR1 | R2>;\n catch\u003cR2>(onrejected: (reason: any) => R2 | PromiseLike\u003cR2>): Promise\u003cT | R2>;\n}\n\ndeclare var Promise: {\n reject(reason: any): Promise\u003cnever>; // Returned promise is never fulfilled\n};\n```\n","author":{"url":"https://github.com/jeffreymorlan","@type":"Person","name":"jeffreymorlan"},"datePublished":"2016-06-15T18:55:33Z","url":"https://github.com/microsoft/TypeScript/issues/9193"}
react-profiling 0 react-import-map react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 route-pattern /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) route-controller voltron_issues_fragments route-action issue_layout fetch-nonce v2:76ce4aa0-ada3-523c-c40d-54792c22189a current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id 9130:3F8A67:9D3F68:D3354E:6B00ED2C html-safe-nonce 05f5c89af5080f8049fc13ced3aafeece9b9c6925bb60d5e7fde4431fb57c0ba visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTMwOjNGOEE2Nzo5RDNGNjg6RDMzNTRFOjZCMDBFRDJDIiwidmlzaXRvcl9pZCI6IjEyMjQzODQ4ODc0MTk2Mjg4NDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== visitor-hmac 47f07cfe20badfc689ee04eb1d30cb5dbe077d95022ea516c125f384e252027a hovercard-subject-tag issue:160497097 github-keyboard-shortcuts repository,issues,copilot google-site-verification Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I octolytics-url https://collector.github.com/github/collect analytics-location / fb:app_id 1401488693436528 apple-itunes-app app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/9193/issue_layout twitter:image https://opengraph.githubassets.com/ca9acdaf7f177e5c3b17927ff702c7d623b5efd7154e4a9c4d6afcb282dc7900/microsoft/TypeScript/issues/9193 twitter:card summary_large_image og:image https://opengraph.githubassets.com/ca9acdaf7f177e5c3b17927ff702c7d623b5efd7154e4a9c4d6afcb282dc7900/microsoft/TypeScript/issues/9193 og:image:alt Expression (p: Promise) Correct type Current type p.then() Promise Promise<{}> p.then(b => 1) Promise Promise p.then(b => 1, e => 'error') Promise og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username jeffreymorlan hostname github.com expected-hostname github.com None 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc turbo-cache-control no-preview go-import github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git octolytics-dimension-user_id 6154722 octolytics-dimension-user_login microsoft octolytics-dimension-repository_id 20929025 octolytics-dimension-repository_nwo microsoft/TypeScript octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 20929025 octolytics-dimension-repository_network_root_nwo microsoft/TypeScript turbo-body-classes logged-out env-production page-responsive disable-turbo false browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release 9983dd5da06943f833c971dd5b6bc988e2858be5 ui-target full theme-color #1e2327 color-scheme light dark react-app-name issues
URLs of crawlers that visited me.