Title: Allow non returning functions to have contextually required `undefined` return type · Issue #36288 · microsoft/TypeScript · GitHub
Open Graph Title: Allow non returning functions to have contextually required `undefined` return type · Issue #36288 · microsoft/TypeScript
X Title: Allow non returning functions to have contextually required `undefined` return type · Issue #36288 · microsoft/TypeScript
Description: Search Terms #36239 Suggestion Allow non returning functions to have contextually required undefined return type. Use Cases Callbacks Examples declare function f(a: () => undefined): void; f(() => { }); // error -> ok f((): undefined => ...
Open Graph Description: Search Terms #36239 Suggestion Allow non returning functions to have contextually required undefined return type. Use Cases Callbacks Examples declare function f(a: () => undefined): void; f(() => ...
X Description: Search Terms #36239 Suggestion Allow non returning functions to have contextually required undefined return type. Use Cases Callbacks Examples declare function f(a: () => undefined): void; f(() ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/36288
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow non returning functions to have contextually required `undefined` return type","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker.\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n * Read the FAQ, especially the \"Common Feature Requests\" section: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\n-->\r\n\r\n## Search Terms\r\n\r\n#36239\r\n\r\n## Suggestion\r\n\r\nAllow non returning functions to have contextually required `undefined` return type.\r\n\r\n## Use Cases\r\n\r\n- Callbacks\r\n\r\n## Examples\r\n\r\n```ts\r\ndeclare function f(a: () => undefined): void;\r\nf(() => { }); // error -> ok\r\nf((): undefined => { }); // error -> ok\r\nconst g1: () => undefined = () => { }; // error -> ok\r\nconst g2 = (): undefined => { }; // error -> ok if possible\r\nfunction h1() {\r\n}\r\nf(h1); // error -> error\r\nfunction h2(): undefined { // error -> ok if possible\r\n}\r\n```\r\n\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n\r\n* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code\r\n* [x] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [x] This could be implemented without emitting different JS based on the types of the expressions\r\n* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)\r\n* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).\r\n","author":{"url":"https://github.com/falsandtru","@type":"Person","name":"falsandtru"},"datePublished":"2020-01-18T17:19:42Z","url":"https://github.com/microsoft/TypeScript/issues/36288"}
| 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:ea1e5713-dac8-7570-be70-d51e5a11bf7b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBDC:339D75:A718C6:EA2E9C:6B04321C |
| html-safe-nonce | 767a0967bc4de87dbb8dcb28a2bea168970b417fa5387630ffa3a262fcebc47e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkRDOjMzOUQ3NTpBNzE4QzY6RUEyRTlDOjZCMDQzMjFDIiwidmlzaXRvcl9pZCI6IjQzMzUyMzQ4MTUyMTg2OTI2MzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3b3affad96b07ce8662d87b897cbf58447781d7a2ca475a300b1f9e58f6e0df8 |
| hovercard-subject-tag | issue:551797511 |
| 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/36288/issue_layout |
| twitter:image | https://opengraph.githubassets.com/251e7d205904dae749298d7e2270f00a309ceb9b7278022cd462f07d593605d2/microsoft/TypeScript/issues/36288 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/251e7d205904dae749298d7e2270f00a309ceb9b7278022cd462f07d593605d2/microsoft/TypeScript/issues/36288 |
| og:image:alt | Search Terms #36239 Suggestion Allow non returning functions to have contextually required undefined return type. Use Cases Callbacks Examples declare function f(a: () => undefined): void; f(() => ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | falsandtru |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| 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 | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width