Title: Incorrect overload is used for `pipe` when first function has optional parameter · Issue #29913 · microsoft/TypeScript · GitHub
Open Graph Title: Incorrect overload is used for `pipe` when first function has optional parameter · Issue #29913 · microsoft/TypeScript
X Title: Incorrect overload is used for `pipe` when first function has optional parameter · Issue #29913 · microsoft/TypeScript
Description: TypeScript Version: 3.3.1 Search Terms: Code when strictFunctionTypes is disabled when first composed function parameter is optional when first pipe overload is zero parameters for first function declare const pipe: { // 0-argument first...
Open Graph Description: TypeScript Version: 3.3.1 Search Terms: Code when strictFunctionTypes is disabled when first composed function parameter is optional when first pipe overload is zero parameters for first function d...
X Description: TypeScript Version: 3.3.1 Search Terms: Code when strictFunctionTypes is disabled when first composed function parameter is optional when first pipe overload is zero parameters for first function d...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/29913
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect overload is used for `pipe` when first function has optional parameter","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. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\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: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n--\u003e\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. --\u003e\r\n**TypeScript Version:** 3.3.1\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) --\u003e\r\n**Search Terms:**\r\n\r\n**Code**\r\n\r\n- when `strictFunctionTypes` is disabled\r\n- when first composed function parameter is optional\r\n- when first `pipe` overload is zero parameters for first function\r\n\r\n```ts\r\ndeclare const pipe: {\r\n // 0-argument first function\r\n // Workaround: disable this overload\r\n \u003cA\u003e(a: () =\u003e A): () =\u003e A;\r\n\r\n // 1-argument first function\r\n \u003cA, B\u003e(ab: (a: A) =\u003e B): (a: A) =\u003e B;\r\n};\r\n\r\n// Expected type: `(a: {} | undefined) =\u003e number`\r\n// Actual type: `() =\u003e number`\r\nconst fn = pipe((_a?: {}) =\u003e 1);\r\n```\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? --\u003e\r\nhttps://github.com/Microsoft/TypeScript/issues/29904","author":{"url":"https://github.com/OliverJAsh","@type":"Person","name":"OliverJAsh"},"datePublished":"2019-02-14T10:24:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/29913/TypeScript/issues/29913"}
| 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:2a64d72c-534d-bdd8-4e37-b3b202ed45d7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A624:A5716:1C931:27450:6A6267E8 |
| html-safe-nonce | 86a8bf956818576fcf00d3f150bf4478a6e3b2b07349f02a0cd102517d13be1b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjI0OkE1NzE2OjFDOTMxOjI3NDUwOjZBNjI2N0U4IiwidmlzaXRvcl9pZCI6Ijg2MDUxMjA3NjkyMTQ4MDE4OTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 180f3421eaef74bfbf0bd46f0ed0c3317219894fcdd0174f32baa0c08833f797 |
| hovercard-subject-tag | issue:410228715 |
| 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/29913/issue_layout |
| twitter:image | https://opengraph.githubassets.com/14bf803737db8ab812f287585941d5857e89bc0c832bb37ae910c9bc321372b1/microsoft/TypeScript/issues/29913 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/14bf803737db8ab812f287585941d5857e89bc0c832bb37ae910c9bc321372b1/microsoft/TypeScript/issues/29913 |
| og:image:alt | TypeScript Version: 3.3.1 Search Terms: Code when strictFunctionTypes is disabled when first composed function parameter is optional when first pipe overload is zero parameters for first function d... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | OliverJAsh |
| hostname | github.com |
| expected-hostname | github.com |
| None | 194bddaed53c0eb07047629c520853f4208e77a17ff57428346485cc202e39f2 |
| 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 | c2862cf2db52f0c7f6cba3de21ffeeafe7c5456e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width