Title: Inferences from type aliases disregard variance · Issue #31659 · microsoft/TypeScript · GitHub
Open Graph Title: Inferences from type aliases disregard variance · Issue #31659 · microsoft/TypeScript
X Title: Inferences from type aliases disregard variance · Issue #31659 · microsoft/TypeScript
Description: TypeScript Version: 3.5.0 and previous Code // @strictFunctionTypes: true type Func
Open Graph Description: TypeScript Version: 3.5.0 and previous Code // @strictFunctionTypes: true type Func
X Description: TypeScript Version: 3.5.0 and previous Code // @strictFunctionTypes: true type Func<T> = (x: T) => void; declare let f1: Func<string>; declare let f2: Func<"a">; decl...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/31659
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inferences from type aliases disregard variance","articleBody":"**TypeScript Version:** 3.5.0 and previous\r\n\r\n**Code**\r\n\r\n```ts\r\n// @strictFunctionTypes: true\r\n\r\ntype Func\u003cT> = (x: T) => void;\r\n\r\ndeclare let f1: Func\u003cstring>;\r\ndeclare let f2: Func\u003c\"a\">;\r\n\r\ndeclare function foo\u003cT>(f1: Func\u003cT>, f2: Func\u003cT>): void;\r\n\r\nfoo(f1, f2); // Error\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nNo error.\r\n\r\n**Actual behavior:**\r\n\r\nError.\r\n\r\nWhen inferring between instantiations of the same type alias we always make covariant inferences instead of computing and using proper variance information.","author":{"url":"https://github.com/ahejlsberg","@type":"Person","name":"ahejlsberg"},"datePublished":"2019-05-29T18:51:30Z","url":"https://github.com/microsoft/TypeScript/issues/31659"}
| 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:839e8aa8-ed3a-3b0f-a0df-539a3c5e054d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E180:17FB7:248093A:2E5144E:6B01BF67 |
| html-safe-nonce | f6ec5ceb283f70c87f4e76c91b61a5823da30a44dcecac30fafd94a2ab5216ca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTgwOjE3RkI3OjI0ODA5M0E6MkU1MTQ0RTo2QjAxQkY2NyIsInZpc2l0b3JfaWQiOiI0NTQ3NjYxNzExNTQwMzM4NTM1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b5b757babb8e21333c5183c6957c0f71bbead8a541435a268efff5e70d5006be |
| hovercard-subject-tag | issue:449966610 |
| 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/31659/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e2692ebd5a50a413fb5f2d57b6d0b31066bd8482b323116f952bf78568891190/microsoft/TypeScript/issues/31659 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e2692ebd5a50a413fb5f2d57b6d0b31066bd8482b323116f952bf78568891190/microsoft/TypeScript/issues/31659 |
| og:image:alt | TypeScript Version: 3.5.0 and previous Code // @strictFunctionTypes: true type Func |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ahejlsberg |
| 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