Title: Conflicting definitions for Set constructor causes unexpected default generic in TS 3.5 · Issue #31990 · microsoft/TypeScript · GitHub
Open Graph Title: Conflicting definitions for Set constructor causes unexpected default generic in TS 3.5 · Issue #31990 · microsoft/TypeScript
X Title: Conflicting definitions for Set constructor causes unexpected default generic in TS 3.5 · Issue #31990 · microsoft/TypeScript
Description: TypeScript Version: 3.4.5 vs versions after 3.5 Search Terms: set constructor setconstructor unknown Code let s = new Set(); Expected behavior: In TS 3.4: we expect the default chosen param to give us a Set<{}>. In TS 3.5: we expect a Se...
Open Graph Description: TypeScript Version: 3.4.5 vs versions after 3.5 Search Terms: set constructor setconstructor unknown Code let s = new Set(); Expected behavior: In TS 3.4: we expect the default chosen param to give...
X Description: TypeScript Version: 3.4.5 vs versions after 3.5 Search Terms: set constructor setconstructor unknown Code let s = new Set(); Expected behavior: In TS 3.4: we expect the default chosen param to give...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/31990
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Conflicting definitions for Set constructor causes unexpected default generic in TS 3.5","articleBody":"**TypeScript Version:** 3.4.5 vs versions after 3.5\r\n\r\n**Search Terms:** set constructor setconstructor unknown\r\n\r\n**Code**\r\n\r\n```ts\r\nlet s = new Set();\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nIn TS 3.4: we expect the default chosen param to give us a `Set\u003c{}>`.\r\nIn TS 3.5: we expect a `Set\u003cunknown>`.\r\nThat change was an intended change in TS 3.5.\r\n\r\nOr, if Set has a default generic arg, I expect the same default chosen in 3.4 and 3.5.\r\n\r\n**Actual behavior:**\r\n\r\nIn TS 3.4, this actually was a `Set\u003cany>`!\r\n\r\nIt appears there are multiple overloads of the Set constructor.\r\n\r\nlib.es2015.collection.d.ts says:\r\n\r\n```\r\n new \u003cT = any>(values?: ReadonlyArray\u003cT> | null): Set\u003cT>;\r\n```\r\n\r\nwhile lib.es2105.iterable.d.ts says:\r\n\r\n```\r\n new \u003cT>(iterable?: Iterable\u003cT> | null): Set\u003cT>;\r\n```\r\n\r\nNote that one has `T = any` and the other doesn't.\r\n\r\nSo somehow TS 3.4 vs TS 3.5 decided to change whether to obey the `any` default, I think?","author":{"url":"https://github.com/evmar","@type":"Person","name":"evmar"},"datePublished":"2019-06-19T23:51:23Z","url":"https://github.com/microsoft/TypeScript/issues/31990"}
| 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:11f11375-ca92-2bbe-7340-b7670148428e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B2BA:DB09F:4D611C:645E28:6B00D993 |
| html-safe-nonce | e884d91943bdaba5310bb13a22fb5b80d6da9ccd162e0cd178a4d3273b60192f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkJBOkRCMDlGOjRENjExQzo2NDVFMjg6NkIwMEQ5OTMiLCJ2aXNpdG9yX2lkIjoiMjM4MDU2MzMzNzcxODU2Mjc1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bb8a63fcd940b92e591ac83fb15b2cb34533eddf97727f6193ee3695f9ee4730 |
| hovercard-subject-tag | issue:458273298 |
| 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/31990/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d99cbf8fbfcc126661e127005613dd245cbe477d9d7f9e94454f28d967902493/microsoft/TypeScript/issues/31990 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d99cbf8fbfcc126661e127005613dd245cbe477d9d7f9e94454f28d967902493/microsoft/TypeScript/issues/31990 |
| og:image:alt | TypeScript Version: 3.4.5 vs versions after 3.5 Search Terms: set constructor setconstructor unknown Code let s = new Set(); Expected behavior: In TS 3.4: we expect the default chosen param to give... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | evmar |
| hostname | github.com |
| expected-hostname | github.com |
| None | a481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b |
| 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 | 84c8c5cc25e2fb7f2308428458538436baecc6d2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width