Title: 4.1 and 4.2-dev fails on "TS7053: Element implicitly has an 'any' type" · Issue #41658 · microsoft/TypeScript · GitHub
Open Graph Title: 4.1 and 4.2-dev fails on "TS7053: Element implicitly has an 'any' type" · Issue #41658 · microsoft/TypeScript
X Title: 4.1 and 4.2-dev fails on "TS7053: Element implicitly has an 'any' type" · Issue #41658 · microsoft/TypeScript
Description: TypeScript Version: 4.1.x and 4.2.0-dev.20201123 Works on 4.0.x Search Terms: TS7053 Code export type ComparablePrimitives = undefined | null | boolean | string | number; export type ComparableArray = Array< Comparable >; export type Com...
Open Graph Description: TypeScript Version: 4.1.x and 4.2.0-dev.20201123 Works on 4.0.x Search Terms: TS7053 Code export type ComparablePrimitives = undefined | null | boolean | string | number; export type ComparableArra...
X Description: TypeScript Version: 4.1.x and 4.2.0-dev.20201123 Works on 4.0.x Search Terms: TS7053 Code export type ComparablePrimitives = undefined | null | boolean | string | number; export type ComparableArra...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/41658
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"4.1 and 4.2-dev fails on \"TS7053: Element implicitly has an 'any' type\"","articleBody":"**TypeScript Version:** 4.1.x and 4.2.0-dev.20201123\r\nWorks on 4.0.x\r\n\r\n**Search Terms: TS7053**\r\n\r\n**Code**\r\n```\r\nexport type ComparablePrimitives = undefined | null | boolean | string | number;\r\nexport type ComparableArray = Array\u003c Comparable >;\r\nexport type ComparableObject = { [ key: string ]: Comparable; };\r\nexport type Comparable =\r\n\t| ComparablePrimitives\r\n\t| ComparableArray\r\n\t| ComparableObject;\r\n\r\nexport function isEqual\u003c T extends Comparable >( a: T, b: T ): boolean;\r\nexport function isEqual\u003c T extends Comparable, U extends Comparable >( a: T, b: U ): false;\r\nexport function isEqual\u003c T extends Comparable, U extends Comparable >( a: T, b: U ): boolean\r\n{\r\n\tif ( Array.isArray( a ) && Array.isArray( b ) )\r\n\t\treturn !a.some( ( value, index ) => !isEqual( value, b[ index ] ) );\r\n\treturn false;\r\n}\r\n```\r\n(the function body in this example is not my real code, but shows the compilation error)\r\n\r\n**Expected behavior:** should compile\r\n\r\n**Actual behavior:** fails with:\r\n\r\n```\r\nTS7053: Element implicitly has an 'any' type because expression of type 'number' can't be used to index type '(undefined & (U extends readonly any[] ? unknown extends U ? never : readonly any[] : any[])) | (null & (U extends readonly any[] ? unknown extends U ? never : readonly any[] : any[])) | (string & (U extends readonly any[] ? unknown extends U ? never : readonly any[] : any[])) | ... 4 more ... | (ComparableObject & ...'.\r\n No index signature with a parameter of type 'number' was found on type '(undefined & (U extends readonly any[] ? unknown extends U ? never : readonly any[] : any[])) | (null & (U extends readonly any[] ? unknown extends U ? never : readonly any[] : any[])) | (string & (U extends readonly any[] ? unknown extends U ? never : readonly any[] : any[])) | ... 4 more ... | (ComparableObject & ...'.\r\n\r\n \treturn !a.some( ( value, index ) => !isEqual( value, b[ index ] ) );\r\n \t ~~~~~~~~~~\r\n```\r\n\r\n**Related Issues:** \r\n","author":{"url":"https://github.com/grantila","@type":"Person","name":"grantila"},"datePublished":"2020-11-23T21:44:52Z","url":"https://github.com/microsoft/TypeScript/issues/41658"}
| 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:6b680e94-1627-026d-c98a-ac00de7b178d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA8C:1050BD:ABF05C:E3E7E4:6B01BEFB |
| html-safe-nonce | e20707a82c0a090c0b27aeb4776eee289fd6074c1499fcb4570d6d44bcb302bd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQThDOjEwNTBCRDpBQkYwNUM6RTNFN0U0OjZCMDFCRUZCIiwidmlzaXRvcl9pZCI6IjcxMDc2MDg2NjExNjEyNjI4NDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9a3c60c954b106c5be3238d13cb4755c0c24d4bf78712d317081acfd85852eba |
| hovercard-subject-tag | issue:749150068 |
| 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/41658/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a8ace53027c303f0ef9a8010828a0f58a06f4b94bee923420bcb75e6ee0dc35f/microsoft/TypeScript/issues/41658 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a8ace53027c303f0ef9a8010828a0f58a06f4b94bee923420bcb75e6ee0dc35f/microsoft/TypeScript/issues/41658 |
| og:image:alt | TypeScript Version: 4.1.x and 4.2.0-dev.20201123 Works on 4.0.x Search Terms: TS7053 Code export type ComparablePrimitives = undefined | null | boolean | string | number; export type ComparableArra... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | grantila |
| 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 | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width