Title: Generic inference inside of `pipe` is incorrect when strict mode is disabled · Issue #25826 · microsoft/TypeScript · GitHub
Open Graph Title: Generic inference inside of `pipe` is incorrect when strict mode is disabled · Issue #25826 · microsoft/TypeScript
X Title: Generic inference inside of `pipe` is incorrect when strict mode is disabled · Issue #25826 · microsoft/TypeScript
Description: TypeScript Version: 2.9.2 Search Terms: Code With strict mode disabled: declare function pipe
Open Graph Description: TypeScript Version: 2.9.2 Search Terms: Code With strict mode disabled: declare function pipe
X Description: TypeScript Version: 2.9.2 Search Terms: Code With strict mode disabled: declare function pipe<V0, T1, T2, T3>( fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, ): (x: V0) ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/25826
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generic inference inside of `pipe` is incorrect when strict mode is disabled","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:** 2.9.2\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\nWith strict mode disabled:\r\n\r\n```ts\r\ndeclare function pipe\u003cV0, T1, T2, T3\u003e(\r\n fn0: (x: V0) =\u003e T1,\r\n fn1: (x: T1) =\u003e T2,\r\n fn2: (x: T2) =\u003e T3,\r\n): (x: V0) =\u003e T3;\r\n\r\ntype Option\u003cT\u003e = { t: T }\r\ndeclare function optionOf\u003cT\u003e(value: T | null | undefined): Option\u003cT\u003e\r\n\r\ndeclare function get(name: \"set-cookie\"): string[] | undefined;\r\ndeclare function get(name: string): string | undefined;\r\n\r\n// $ExpectType (x: {}) =\u003e Option\u003cstring\u003e\r\n// but got (x: {}) =\u003e Option\u003c{}\u003e\r\n// Note: with strict mode enabled, we get the expected type.\r\nconst fn = pipe(\r\n ({}: {}) =\u003e 'foo',\r\n string =\u003e get(string),\r\n // Workaround: pass the function directly, instead of wrapping:\r\n // get,\r\n optionOf,\r\n);\r\n```\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? --\u003e\r\nThis is similar to—but not exactly the same as—other issues I've filed when trying to use `pipe`:\r\n- https://github.com/Microsoft/TypeScript/issues/25637\r\n- https://github.com/Microsoft/TypeScript/issues/25791","author":{"url":"https://github.com/OliverJAsh","@type":"Person","name":"OliverJAsh"},"datePublished":"2018-07-20T12:51:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/25826/TypeScript/issues/25826"}
| 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:a799ce0a-2f7c-f8c9-2d7b-9ae3e69a439a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A92C:26DA3B:3FD629:5B677D:6A61E767 |
| html-safe-nonce | 79d246f7205d5ad8558f7b19ff409a81046a3bf8fbab763ed8a19b940cc67c3f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTJDOjI2REEzQjozRkQ2Mjk6NUI2NzdEOjZBNjFFNzY3IiwidmlzaXRvcl9pZCI6IjMxMzE0NjUzMDAxNTgwNDgxMDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e12c8c9f7f21a60c7a5c2540b59c2ec3f35441abbae735c9f68e86514497a544 |
| hovercard-subject-tag | issue:343095852 |
| 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/25826/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ef4e0752f4846e7045f7c2c03786185dd7c563fb81f1fd9dc1ee40dc001be0e9/microsoft/TypeScript/issues/25826 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ef4e0752f4846e7045f7c2c03786185dd7c563fb81f1fd9dc1ee40dc001be0e9/microsoft/TypeScript/issues/25826 |
| og:image:alt | TypeScript Version: 2.9.2 Search Terms: Code With strict mode disabled: declare function pipe |
| 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 | b2de8c74e5e61e893155ba46ee41bc66170c1644cb795adefa8386d490f7781c |
| 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 | d1866027ded575df8a15c731dd8b9986c9483ceb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width