Title: polymorphic arguments validation error · Issue #20268 · microsoft/TypeScript · GitHub
Open Graph Title: polymorphic arguments validation error · Issue #20268 · microsoft/TypeScript
X Title: polymorphic arguments validation error · Issue #20268 · microsoft/TypeScript
Description: TypeScript Version: 2.7.0-dev.20171126 (Introduced in 2.6) Code type Processor
Open Graph Description: TypeScript Version: 2.7.0-dev.20171126 (Introduced in 2.6) Code type Processor
X Description: TypeScript Version: 2.7.0-dev.20171126 (Introduced in 2.6) Code type Processor<T extends object> = <T1 extends T>(subj: T1) => T1 function doStuff<T extends object, T1 extends T&g...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/20268
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"polymorphic arguments validation error","articleBody":"**TypeScript Version:** 2.7.0-dev.20171126 \r\n(Introduced in 2.6)\r\n\r\n**Code**\r\n\r\n```ts\r\ntype Processor\u003cT extends object> = \u003cT1 extends T>(subj: T1) => T1\r\nfunction doStuff\u003cT extends object, T1 extends T>(parentProcessors: Array\u003cProcessor\u003cT>>, childProcessors : Array\u003cProcessor\u003cT1>>) {\r\n childProcessors.concat(parentProcessors);\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\npass validation (polymorphism etc.)\r\n\r\n**Actual behavior:**\r\nError:(3, 28) TS2345:Argument of type 'Processor\u003cT>[]' is not assignable to parameter of type 'Processor\u003cT1> | ReadonlyArray\u003cProcessor\u003cT1>>'.\r\n Type 'Processor\u003cT>[]' is not assignable to type 'ReadonlyArray\u003cProcessor\u003cT1>>'.\r\n Types of property 'indexOf' are incompatible.\r\n Type '(searchElement: Processor\u003cT>, fromIndex?: number | undefined) => number' is not assignable to type '(searchElement: Processor\u003cT1>, fromIndex?: number | undefined) => number'.\r\n Types of parameters 'searchElement' and 'searchElement' are incompatible.\r\n Types of parameters 'subj' and 'subj' are incompatible.\r\n Type 'T1' is not assignable to type 'T1'. Two different types with this name exist, but they are unrelated.\r\n Type 'T' is not assignable to type 'T1'.\r\n Type 'object' is not assignable to type 'T1'.","author":{"url":"https://github.com/amir-arad","@type":"Person","name":"amir-arad"},"datePublished":"2017-11-26T13:12:02Z","url":"https://github.com/microsoft/TypeScript/issues/20268"}
| 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:ed7f079d-c876-1bb2-941a-304eb992225f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8596:1DCB8C:CBDA98:10EE483:6B00F61D |
| html-safe-nonce | ae29d1bfc189381a0cb6fd0c3fdfbef567c6b2d142643db0614d41e7a536954d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTk2OjFEQ0I4QzpDQkRBOTg6MTBFRTQ4Mzo2QjAwRjYxRCIsInZpc2l0b3JfaWQiOiIyMDkzMjA4ODYxMDQwMjQ0MjUzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 46a16caefe4f5b33aca9917f7794eba9f43890cd978d6d091b02c30cd0e7fa6a |
| hovercard-subject-tag | issue:276823779 |
| 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/20268/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8d848d5b0472fa98c605a5c99e56264d4fd2cb51418fc8c30d573f2b595465e2/microsoft/TypeScript/issues/20268 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8d848d5b0472fa98c605a5c99e56264d4fd2cb51418fc8c30d573f2b595465e2/microsoft/TypeScript/issues/20268 |
| og:image:alt | TypeScript Version: 2.7.0-dev.20171126 (Introduced in 2.6) Code type Processor |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | amir-arad |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width