Title: [TS2.5 regression] Object.values(someEnum) returns string[] (not any[]/number[]) · Issue #21089 · microsoft/TypeScript · GitHub
Open Graph Title: [TS2.5 regression] Object.values(someEnum) returns string[] (not any[]/number[]) · Issue #21089 · microsoft/TypeScript
X Title: [TS2.5 regression] Object.values(someEnum) returns string[] (not any[]/number[]) · Issue #21089 · microsoft/TypeScript
Description: TypeScript Version: 2.7.0-dev.201xxxxx Code enum X {A, B} const xs = Object.values(X); xs.includes(1); Expected behavior: In TS2.5, this used to compile, because xs was any[]. Actual behavior: In TS2.6+, xs is string[]. That's wrong: > O...
Open Graph Description: TypeScript Version: 2.7.0-dev.201xxxxx Code enum X {A, B} const xs = Object.values(X); xs.includes(1); Expected behavior: In TS2.5, this used to compile, because xs was any[]. Actual behavior: In T...
X Description: TypeScript Version: 2.7.0-dev.201xxxxx Code enum X {A, B} const xs = Object.values(X); xs.includes(1); Expected behavior: In TS2.5, this used to compile, because xs was any[]. Actual behavior: In T...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/21089
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[TS2.5 regression] Object.values(someEnum) returns string[] (not any[]/number[])","articleBody":"**TypeScript Version:** 2.7.0-dev.201xxxxx\r\n\r\n**Code**\r\n\r\n```ts\r\nenum X {A, B}\r\n\r\nconst xs = Object.values(X);\r\nxs.includes(1);\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nIn TS2.5, this used to compile, because `xs` was `any[]`.\r\n\r\n**Actual behavior:**\r\n\r\nIn TS2.6+, `xs` is `string[]`. That's wrong:\r\n\r\n```\r\n> Object.values({A: 1, B: 2})\r\n[ 1, 2 ]\r\n```\r\n\r\n**Related:**\r\n\r\nCuriously, this only happens for enums. `{[k: ...}: V}` style objects work fine.\r\n\r\n```\r\nconst z: {[k: string]: number} = {\r\n A: 1\r\n}\r\nconst zs = Object.values(z);\r\nzs.includes(1);\r\n```","author":{"url":"https://github.com/mprobst","@type":"Person","name":"mprobst"},"datePublished":"2018-01-09T14:02:01Z","url":"https://github.com/microsoft/TypeScript/issues/21089"}
| 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:65ae6a8d-868d-b746-bfd9-0d88b622ee7a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA42:3C59B5:E9E1EA:138F024:6B03E1C3 |
| html-safe-nonce | d0abb64982b9ec321a22f700181d9d98f71f70c63b070e6c2a6f1b81f428cf3c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTQyOjNDNTlCNTpFOUUxRUE6MTM4RjAyNDo2QjAzRTFDMyIsInZpc2l0b3JfaWQiOiIzMDI3ODMwMzU5MjQ2MjM0MDUxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0f87fc01d3f48b8ffce2b39d2ae1c1936ded46e8434e8388f906c72785bbc4c9 |
| hovercard-subject-tag | issue:287098854 |
| 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/21089/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fa3857d9f58e072c8eb39428ad78261209f80b8346508fcac265f6320df5379c/microsoft/TypeScript/issues/21089 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fa3857d9f58e072c8eb39428ad78261209f80b8346508fcac265f6320df5379c/microsoft/TypeScript/issues/21089 |
| og:image:alt | TypeScript Version: 2.7.0-dev.201xxxxx Code enum X {A, B} const xs = Object.values(X); xs.includes(1); Expected behavior: In TS2.5, this used to compile, because xs was any[]. Actual behavior: In T... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mprobst |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width