Title: Generic function with rest parameter assignability not transitive · Issue #32948 · microsoft/TypeScript · GitHub
Open Graph Title: Generic function with rest parameter assignability not transitive · Issue #32948 · microsoft/TypeScript
X Title: Generic function with rest parameter assignability not transitive · Issue #32948 · microsoft/TypeScript
Description: TypeScript Version: 3.5.1 typescript@3.7.0-dev.20190815 #32924 (comment) https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/40404/artifacts?artifactName=tgz&fileId=AD9D22CF70561BEAF5758E061B61D3FF...
Open Graph Description: TypeScript Version: 3.5.1 typescript@3.7.0-dev.20190815 #32924 (comment) https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/40404/artifacts?artifactName=tgz...
X Description: TypeScript Version: 3.5.1 typescript@3.7.0-dev.20190815 #32924 (comment) https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/40404/artifacts?artifactName=tgz...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/32948
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generic function with rest parameter assignability not transitive","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-->\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** \r\n+ 3.5.1\r\n+ typescript@3.7.0-dev.20190815\r\n+ https://github.com/microsoft/TypeScript/pull/32924#issuecomment-521819476\r\n https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/40404/artifacts?artifactName=tgz&fileId=AD9D22CF70561BEAF5758E061B61D3FF891ADF664E37C532F5881393CE7DC83202&fileName=/typescript-3.7.0-insiders.20190815.tgz\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:**\r\n\r\n**Code**\r\n\r\n```ts\r\n/**\r\n * --strictFunctionTypes\r\n */\r\n\r\nexport type ExtendedMapper\u003cHandledInputT, OutputT, ArgsT extends any[]> = (\r\n (name : string, mixed : HandledInputT, ...args : ArgsT) => OutputT\r\n);\r\n\r\n//type a = (name: string, mixed: any, args_0: any) => any\r\ntype a = ExtendedMapper\u003cany, any, [any]>;\r\n//type b = (name: string, mixed: any, ...args: any[]) => any\r\ntype b = ExtendedMapper\u003cany, any, any[]>;\r\n//3.5.1, typescript@3.7.0-dev.20190815\r\n//Expected: \"y\"\r\n//Actual : \"y\"\r\n//https://github.com/microsoft/TypeScript/pull/32924#issuecomment-521819476\r\n//https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/40404/artifacts?artifactName=tgz&fileId=AD9D22CF70561BEAF5758E061B61D3FF891ADF664E37C532F5881393CE7DC83202&fileName=/typescript-3.7.0-insiders.20190815.tgz\r\n//Expected: \"y\"\r\n//Actual : \"n\" \u003c-- Intentional?\r\ntype test = a extends b ? \"y\" : \"n\"\r\n\r\ntype a2 = (name: string, mixed: any, args_0: any) => any\r\ntype b2 = (name: string, mixed: any, ...args: any[]) => any\r\n//3.5.1, typescript@3.7.0-dev.20190815\r\n//Expected: \"y\"\r\n//Actual : \"y\"\r\n//https://github.com/microsoft/TypeScript/pull/32924#issuecomment-521819476\r\n//https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/40404/artifacts?artifactName=tgz&fileId=AD9D22CF70561BEAF5758E061B61D3FF891ADF664E37C532F5881393CE7DC83202&fileName=/typescript-3.7.0-insiders.20190815.tgz\r\n//Expected: \"y\"\r\n//Actual : \"y\"\r\ntype test2 = a2 extends b2 ? \"y\" : \"n\"\r\n\r\n//a extends b2 extends b\r\n//However, a DOES NOT extend b\r\n//It seems assignability is not transitive...\r\n\r\n//\"y\" for all versions\r\ntype aExtendsB2 = a extends b2 ? \"y\" : \"n\"\r\n//\"y\" for all versions\r\ntype b2ExtendsB = b2 extends b ? \"y\" : \"n\"\r\n\r\ntype TakeExtendedMapperRest\u003cMapperT extends b> = (\r\n [\"Blah\", MapperT]\r\n);\r\n\r\n//Works in 3.5.1\r\n//Fails for https://github.com/microsoft/TypeScript/pull/32924#issuecomment-521819476\r\nexport type ShouldWorkButFails\u003cT extends a> = (\r\n //Type 'ExtendedMapper\u003cany, any, [any]>' does not satisfy the constraint 'ExtendedMapper\u003cany, any, any[]>'.\r\n // Property '0' is missing in type 'any[]' but required in type '[any]'.ts(2344)\r\n //a -> b not allowed\r\n TakeExtendedMapperRest\u003cT>\r\n // ~\r\n);\r\n\r\n//Works in 3.5.1\r\n//Works in https://github.com/microsoft/TypeScript/pull/32924#issuecomment-521819476\r\nexport type Workaround\u003cT extends a> = (\r\n TakeExtendedMapperRest\u003c\r\n //OK!\r\n //Takes advantage of a -> b2 -> b being allowed\r\n Extract\u003cT, b2>\r\n >\r\n);\r\n\r\n//Works in 3.5.1\r\n//Fails in https://github.com/microsoft/TypeScript/pull/32924#issuecomment-521819476\r\ntype WorkaroundTest = TakeExtendedMapperRest\u003ca>;\r\n\r\n//Works in 3.5.1\r\n//Works in https://github.com/microsoft/TypeScript/pull/32924#issuecomment-521819476\r\n//type WorkaroundTest2 = [\"Blah\", ExtendedMapper\u003cany, any, [any]>]\r\ntype WorkaroundTest2 = Workaround\u003ca>; //Success\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nBuild in https://github.com/microsoft/TypeScript/pull/32924#issuecomment-521819476 should behave the same as 3.5.1 and typescript@3.7.0-dev.20190815\r\n\r\nAssignability should be transitive.\r\n\r\na -> b2 -> b should imply a -> b\r\n\r\n**Actual behavior:**\r\n\r\nAssignability is not transitive\r\n\r\na -> b2 -> b **but** not a -> b\r\n\r\n**Playground Link:** \r\n[Playground](http://www.typescriptlang.org/play/#code/PQKhCgAIUhaWDOAXATgSwMZIGIFcB2WaA9vgCoCeADgKYJQjDjg0AeVxKSkS1NkAUVZIa+ACY0xAWQCGVWigA8ACRniANpICS+KriRkANJADy+vQeMBBFAHMEZSGxHiEkNRQDaAXQB8kAF5IAAooSHDg-BkAW34ALkhkdHxbY2i0VklIBNUNbV19I0gAOlKZOzcEm3syAEpA-zMkCzJwWoBuZmBgXlp3QJCo2ISktBS0jMkEj2Ny+wB9AAZp-Ap6gP8PcF7+GQGhFwlpOQVFGfdV408PP07uncgAIwHImJoR1DHUyHTMsRWKMZSsU5ggAT51ptVts+E99sJREdZPIaEpzujVj5fHdgABmYoAVmKAEZjDsEBh0FQkAABfEAdmKi1gEgAbsUAEyLYkATkWAA5iQTwN0hLQsFNIAAiChSkXAKxYXAydThBIyuXdAAWSGaYO6tjQSC1uEexQwxGiwHSlOICGIADMkMBKLQAMqUtDU4B6dTqPEcnkcgAsAGI0AgELgaBborF8EhYASOcTBTzg-SAGzynV6uL3PgUqlIYqsiPK9TIXBiEjmy3ADAO+kyDDE4OZlnJgmwYPB3EYWCPDn92CLMQE-m43H0mgOmiPDDAeZyCPAR64NDqMRrjdbhDAYOLQ-B4DlJBoB0tpAIAD8Z4vV4Acm8AkhbAAvABkDs3NC0YgCKwABEeSAjkOQAYWwelFgJTNiQAIQEKxsAJekJwERZ4IQ+CgNxbBsH5HliWA7BM0zYMBGnCCCVxDlUP5QVcR5XEIIEekgIgycuQ5b9f2fWIAh6QtPWpWAGSZWAxgQNAJBQBBOW5PlBSJN933lMUYxEf5pVleVFSQCs1WlfApUgRR4EgHQXHPUgVRvGE+hEZABj2ZxETcZ4b10sz1VM5gHhkDkXiGd5Ek+cYfkmHT0QqJYAUhC4KEc-ghxCt4PmSb5fklc5gVBc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EKcbOARSng0C+FXdQ5SxAAvCAcFAV4eHGCHM0tpzSOh9L-uMoZ5VQHgMrIMyZ8DpljRQXMjBs1sFCzwaswM6yNokO2ts8h+10z7IeKcqaBAxBkG1gMB5NTpGvLONiMlbCKXAOJD-cldKBpTMQUy+sLKZpYPdBylZq0eXEK2nGAVe1KH7NOicv+ZyJVSuQG3W+99H7P0EE86RZxZHnFSRQPwH9RWOvFeIF1OsBhivOWIRV7QnHADdLgDAGA6AICAA)\r\n\r\n**Related Issues:** \r\n\r\nhttps://github.com/microsoft/TypeScript/pull/32924#issuecomment-521826091\r\n\r\nhttps://github.com/microsoft/TypeScript/pull/32924#issuecomment-521834620\r\n\r\nhttps://github.com/microsoft/TypeScript/pull/32924#issuecomment-521930291\r\n\r\nI'm not sure which commit introduced this problem.\r\n\r\n@weswigham ","author":{"url":"https://github.com/AnyhowStep","@type":"Person","name":"AnyhowStep"},"datePublished":"2019-08-17T00:59:31Z","url":"https://github.com/microsoft/TypeScript/issues/32948"}
| 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:47308f19-515f-1357-64bf-36cd521d9849 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD12:E3C4F:2C9B9BA:38E8122:6B01BCF1 |
| html-safe-nonce | ead356c4e356ab3198d8e843d00a357cbedeecfeeafe513dd4b4dceef11b75db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDEyOkUzQzRGOjJDOUI5QkE6MzhFODEyMjo2QjAxQkNGMSIsInZpc2l0b3JfaWQiOiI0MDIyODA3NDM5NDI5NzEzMTM3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 644d116a438e7b8722e9003aef5c3fbfaa2eff23632026fe456bd2432369b672 |
| hovercard-subject-tag | issue:481830718 |
| 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/32948/issue_layout |
| twitter:image | https://opengraph.githubassets.com/18319eb05c9453b33e7393ea02a3e764c4adbd8dcd449337346f60db1772531b/microsoft/TypeScript/issues/32948 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/18319eb05c9453b33e7393ea02a3e764c4adbd8dcd449337346f60db1772531b/microsoft/TypeScript/issues/32948 |
| og:image:alt | TypeScript Version: 3.5.1 typescript@3.7.0-dev.20190815 #32924 (comment) https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/40404/artifacts?artifactName=tgz... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AnyhowStep |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width