Title: Compile errors with a generic base class and class mixins using declarative typings · Issue #14017 · microsoft/TypeScript · GitHub
Open Graph Title: Compile errors with a generic base class and class mixins using declarative typings · Issue #14017 · microsoft/TypeScript
X Title: Compile errors with a generic base class and class mixins using declarative typings · Issue #14017 · microsoft/TypeScript
Description: TypeScript Version: 2.2.0 (rc) & 2.2.0-dev.20170211 I am having trouble creating consumable typings when using class mixins for a generic class from a core library - github example repro here https://github.com/agubler/typescript-mixin-t...
Open Graph Description: TypeScript Version: 2.2.0 (rc) & 2.2.0-dev.20170211 I am having trouble creating consumable typings when using class mixins for a generic class from a core library - github example repro here https...
X Description: TypeScript Version: 2.2.0 (rc) & 2.2.0-dev.20170211 I am having trouble creating consumable typings when using class mixins for a generic class from a core library - github example repro here h...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/14017
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Compile errors with a generic base class and class mixins using declarative typings","articleBody":"**TypeScript Version:** 2.2.0 (rc) & 2.2.0-dev.20170211\r\n\r\nI am having trouble creating consumable typings when using class mixins for a generic class from a core library - github example repro here https://github.com/agubler/typescript-mixin-typings.\r\n\r\nConsider the following provided by a core library\r\n\r\n```ts\r\n// BaseClass.ts\r\nexport type Constructor\u003cT> = new (...args: any[]) => T;\r\n\r\nexport class MyBaseClass\u003cT> {\r\n baseProperty: string;\r\n\r\n constructor(value: T) {}\r\n}\r\n```\r\n\r\n```ts\r\n// MixinClass.ts\r\nimport { Constructor, MyBaseClass } from './BaseClass.ts';\r\n\r\nexport interface MyMixin {\r\n mixinProperty: string;\r\n}\r\n\r\nexport function MyMixin\u003cT extends Constructor\u003cMyBaseClass\u003cany>>>(base: T): T & Constructor\u003cMyMixin> {\r\n mixinProperty: string;\r\n}\r\n```\r\n\r\n```ts\r\n// FinalClass\r\nexport class MyExtendedClass extends MyMixin(MyBaseClass)\u003cstring> {\r\n\textendedClassProperty: number;\r\n}\r\n```\r\n\r\ncompiling with `declarations` `true`\r\n\r\n```json\r\n{\r\n\t\t\"declaration\": true,\r\n\t\t\"emitDecoratorMetadata\": true,\r\n\t\t\"experimentalDecorators\": true,\r\n\t\t\"module\": \"umd\",\r\n\t\t\"moduleResolution\": \"node\",\r\n\t\t\"noImplicitAny\": true,\r\n\t\t\"noImplicitThis\": true,\r\n\t\t\"removeComments\": false,\r\n\t\t\"sourceMap\": true,\r\n\t\t\"strictNullChecks\": true,\r\n\t\t\"target\": \"es5\"\r\n}\r\n```\r\n\r\nUsage in downstream consumer project:\r\n\r\n```ts\r\nimport { MyExtendedClass } from 'core-library/FinalClass';\r\nimport { MyMixin } from 'core-library/MixinClass';\r\n\r\n// constructor signature lost\r\nconst myExtendedClass = new MyExtendedClass('string');\r\n\r\n// MyExtendedClass no longer type MyBaseClass\r\nconst AnotherMixedClass = MyMixin(MyExtendedClass);\r\n```\r\n\r\nErrors:\r\n`5 col 25 error| Supplied parameters do not match any signature of call target. [typescript/tsuquyomi]`\r\n\r\n`8 col 35 error| Argument of type 'typeof MyExtendedClass' is not assignable to parameter of type 'Constructor\u003cMyBaseClass\u003cany>>'. Type 'MyExtendedClass' is not assignable to type 'MyBaseClass\u003cany>'. Property 'baseProperty' is missing in type 'MyExtendedClass'. [typescript/tsuquyomi]`","author":{"url":"https://github.com/agubler","@type":"Person","name":"agubler"},"datePublished":"2017-02-11T08:13:48Z","url":"https://github.com/microsoft/TypeScript/issues/14017"}
| 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:b8cb400c-3a4c-949c-48e6-fbe1ff2f9d10 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E402:2E3FEE:8DE6BA:B51C08:6B00EB96 |
| html-safe-nonce | 3bd41740ed7c4efa2e3bc5e36bf7d0b712e6d82b7da68592357eab71ee034e1c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDAyOjJFM0ZFRTo4REU2QkE6QjUxQzA4OjZCMDBFQjk2IiwidmlzaXRvcl9pZCI6IjI5MjI1MDAzOTIzMDAzNzQ5MzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9546e84b04c86f33744a0ebeadfc82342fbeee44a5a9c4b67101ddf395d92574 |
| hovercard-subject-tag | issue:206966774 |
| 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/14017/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fdb257885be4383100142d8d1eb38a5214fb324cd69009324d94c9defa67b64d/microsoft/TypeScript/issues/14017 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fdb257885be4383100142d8d1eb38a5214fb324cd69009324d94c9defa67b64d/microsoft/TypeScript/issues/14017 |
| og:image:alt | TypeScript Version: 2.2.0 (rc) & 2.2.0-dev.20170211 I am having trouble creating consumable typings when using class mixins for a generic class from a core library - github example repro here https... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | agubler |
| 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