Title: Possible breaking change: assigning array to 1-tuple · Issue #42504 · microsoft/TypeScript · GitHub
Open Graph Title: Possible breaking change: assigning array to 1-tuple · Issue #42504 · microsoft/TypeScript
X Title: Possible breaking change: assigning array to 1-tuple · Issue #42504 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms dom, tuple, assignability 🕗 Version & Regression Information Repros in 4.2 Beta and nightly This changed between versions 4.1.3 and 4.2 beta Important caveat: The code was originally building against 4.1 and had...
Open Graph Description: Bug Report 🔎 Search Terms dom, tuple, assignability 🕗 Version & Regression Information Repros in 4.2 Beta and nightly This changed between versions 4.1.3 and 4.2 beta Important caveat: The code was...
X Description: Bug Report 🔎 Search Terms dom, tuple, assignability 🕗 Version & Regression Information Repros in 4.2 Beta and nightly This changed between versions 4.1.3 and 4.2 beta Important caveat: The code...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/42504
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible breaking change: assigning array to 1-tuple","articleBody":"# Bug Report\r\n\r\n### 🔎 Search Terms\r\n\r\ndom, tuple, assignability\r\n\r\n### 🕗 Version & Regression Information\r\n\r\nRepros in 4.2 Beta and nightly\r\n\r\n- This changed between versions 4.1.3 and 4.2 beta\r\n\r\n**Important caveat:** The code was originally building against 4.1 and had polyfills for types that are in lib.dom.d.ts in 4.2.\r\n\r\n### ⏯ Playground Link\r\n\r\nTS 4.1.3 with polyfills: [Playground](https://www.typescriptlang.org/play?ts=4.1.3#code/JYOwLgpgTgZghgYwgAgEoQM7AF4QPIBGG0AbtAMJwA2VBiA1sgN4BQyyAFBOFMJgFxpMOfEVLQAojwCeAbQC6AGmQB7MVDJRB6LLkLEN0AJSCSK4ABMA3CwC+LFqEixEKHSP3ioUsFGnM2ZCgIOAsVECp-MDgoAHMIMEEJKggAW24wG3Zg0PDI5ARwyHB0BETkABE8AFlSsHRQvAjpG3tHcGh4JCFdUQNNAPY1fogOaLiEpJT08BNkM0ss5ABXEGHxMZj48uS0jLmF60CLYAxCkBAIMo4D8yO2p07XHo91TQBJEAxokG7WbJCYWayAADlAVGAIdIQRBtMI9G9oEtLgB3TgIai0Bhw3qeQxQSg0OgIehzdwIkZQVoOCxXKgxFApMAvCleHGvSmfb5wX4QGztZxdFAAdVAYTR-yCgLy-nJfTZLPl+K5PyQ1JY52+UtxiKgyAAvMhUYq8ZoOBxZBk-PJ2az8T4-AojAaAHyDZBW6R2IxWIA)\r\n\r\nTS 4.2 beta with re-declaration of lib.dom.d.ts interface: [Playground](https://www.typescriptlang.org/play?ts=4.2.0-beta#code/JYOwLgpgTgZghgYwgAgEoQM7AF4QPIBGG0AbtAMJwA2VBiA1sgN4BQyyAFBOFMJgFxpMOfEVLQAojwCeAbQC6AGmQB7MVDJRB6LLkLEN0AJSCSK4ABMA3CwC+LFghUgMYZFGF71m5AF5kIBAA7kK6ogaaHByy3GBQ0vJGfgB8zGzIsfF2RlZAA)\r\n\r\n### 💻 Code\r\n\r\n\u003c!-- Please post the relevant code sample here as well-->\r\n```ts\r\ninterface ResizeObserverCallback {\r\n (entries: ResizeObserverEntry[], observer: ResizeObserver): void;\r\n}\r\n\r\nconst resizeObserver = new ResizeObserver(([entry]) => {\r\n entry\r\n});\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\n```\r\nArgument of type '([entry]: [any]) => void' is not assignable to parameter of type 'ResizeObserverCallback'.\r\n Types of parameters '__0' and 'entries' are incompatible.\r\n Type 'ResizeObserverEntry[]' is not assignable to type '[any]'.\r\n Target requires 1 element(s) but source may have fewer.(2345)\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\nThe fact that the repro depends on re-declaring a dom interface is suspicious, but the re-declaration appears to be identical, so it's not obvious to me why this error would be produced.\r\n\r\nAlso, note that the (as a result of sensible variance reasons), the lambda parameter is listed before the callback parameter on line 2 of the error and the types are in the _opposite_ order on line 3 of the error. I found this confusing.\r\n","author":{"url":"https://github.com/amcasey","@type":"Person","name":"amcasey"},"datePublished":"2021-01-26T23:58:41Z","url":"https://github.com/microsoft/TypeScript/issues/42504"}
| 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:84120c23-b9b8-61df-9d11-481a5ff8d182 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ACA2:4BB79:707244:914664:6B00E3FC |
| html-safe-nonce | 2ff701b1d2ed674b8d1b23130afb7e3170e71da97b80379562dcd6eceb04a595 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0EyOjRCQjc5OjcwNzI0NDo5MTQ2NjQ6NkIwMEUzRkMiLCJ2aXNpdG9yX2lkIjoiNTI0ODM0MDQxMjc2MTk1NzM3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 94de17548d25e2595d2bfa53ce6ea60012c881ee305c10001db1e4e40f620abf |
| hovercard-subject-tag | issue:794650423 |
| 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/42504/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f4a4a8351cdc65f9113007fdefaa7c96e5df67fb0495b44ef5ff2f017283bd46/microsoft/TypeScript/issues/42504 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f4a4a8351cdc65f9113007fdefaa7c96e5df67fb0495b44ef5ff2f017283bd46/microsoft/TypeScript/issues/42504 |
| og:image:alt | Bug Report 🔎 Search Terms dom, tuple, assignability 🕗 Version & Regression Information Repros in 4.2 Beta and nightly This changed between versions 4.1.3 and 4.2 beta Important caveat: The code was... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | amcasey |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| 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 | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width