Title: Tuple types get incorrect contextual type · Issue #9901 · microsoft/TypeScript · GitHub
Open Graph Title: Tuple types get incorrect contextual type · Issue #9901 · microsoft/TypeScript
X Title: Tuple types get incorrect contextual type · Issue #9901 · microsoft/TypeScript
Description: TypeScript Version: $ tsc --version Version 2.0.0 Code // concat-bug.ts var a : Array<[number, number]>= [[1, 2]]; // Typescript detects these first two tuples as arrays of numbers (`number[]`) instead of `[number, number]` a.concat([[3,...
Open Graph Description: TypeScript Version: $ tsc --version Version 2.0.0 Code // concat-bug.ts var a : Array<[number, number]>= [[1, 2]]; // Typescript detects these first two tuples as arrays of numbers (`number[]`) ins...
X Description: TypeScript Version: $ tsc --version Version 2.0.0 Code // concat-bug.ts var a : Array<[number, number]>= [[1, 2]]; // Typescript detects these first two tuples as arrays of numbers (`number[]...
Mail addresses
notifications@github.com
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9901
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tuple types get incorrect contextual type","articleBody":"**TypeScript Version:** \n\n```\n$ tsc --version\nVersion 2.0.0\n```\n\n**Code**\n\n``` ts\n// concat-bug.ts\nvar a : Array\u003c[number, number]>= [[1, 2]];\n\n// Typescript detects these first two tuples as arrays of numbers (`number[]`) instead of `[number, number]`\na.concat([[3, 4], [5, 6], [7, 8]]);\n```\n\n**Expected behavior:**\nNo compile errors. (It works in the 1.8 playground)\n\n**Actual behavior:** \n\n```\n$ tsc concat-bug.ts\nconcat-bug.ts(4,10): error TS2345: Argument of type '[number[], number[], [number, number]]' is not assignable to parameter of type '[number, number] | [number, number][]'.\n Type '[number[], number[], [number, number]]' is not assignable to type '[number, number][]'.\n Types of property 'pop' are incompatible.\n Type '() => number[] | [number, number]' is not assignable to type '() => [number, number]'.\n Type 'number[] | [number, number]' is not assignable to type '[number, number]'.\n Type 'number[]' is not assignable to type '[number, number]'.\n Property '0' is missing in type 'number[]'.\n```\n\nNote that the 3rd parameter is correctly detected as a tuple, but the first two are detected as arrays of numbers.\n","author":{"url":"https://github.com/Taytay","@type":"Person","name":"Taytay"},"datePublished":"2016-07-22T16:39:07Z","url":"https://github.com/microsoft/TypeScript/issues/9901"}
| 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:a3369d6f-c1e8-3ab3-8f22-7e626a2bda57 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B0A4:91CF4:10D1C64:164FB7E:6B010DBA |
| html-safe-nonce | 89494f2cbe4fc51d56c120426cbd2224817e7f8890f12f3386acd020fc4fedb2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEE0OjkxQ0Y0OjEwRDFDNjQ6MTY0RkI3RTo2QjAxMERCQSIsInZpc2l0b3JfaWQiOiIxODkyMzI3NzA0MzkzNDg1NzU0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b1568f457fc49fc5f04959f195432910a61dbfa0be1dfc85c7a2d7df9838a597 |
| hovercard-subject-tag | issue:167084856 |
| 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/9901/issue_layout |
| twitter:image | https://opengraph.githubassets.com/547def50d9f153278eb458dfd7ddbc642e15c7ab04f4a99d486a42c8fb4cf4dc/microsoft/TypeScript/issues/9901 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/547def50d9f153278eb458dfd7ddbc642e15c7ab04f4a99d486a42c8fb4cf4dc/microsoft/TypeScript/issues/9901 |
| og:image:alt | TypeScript Version: $ tsc --version Version 2.0.0 Code // concat-bug.ts var a : Array<[number, number]>= [[1, 2]]; // Typescript detects these first two tuples as arrays of numbers (`number[]`) ins... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Taytay |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width