Title: Vue.extend return type error TS2322 with 4.6.2 · Issue #48089 · microsoft/TypeScript · GitHub
Open Graph Title: Vue.extend return type error TS2322 with 4.6.2 · Issue #48089 · microsoft/TypeScript
X Title: Vue.extend return type error TS2322 with 4.6.2 · Issue #48089 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms vue ts2322 could be instantiated with an arbitrary type 🕗 Version & Regression Information Versions that exhibits the undesired behavior: 4.6.0-beta, 4.6.1-rc, 4.6.2, next Version that works: 4.5.5 This changed ...
Open Graph Description: Bug Report 🔎 Search Terms vue ts2322 could be instantiated with an arbitrary type 🕗 Version & Regression Information Versions that exhibits the undesired behavior: 4.6.0-beta, 4.6.1-rc, 4.6.2, next...
X Description: Bug Report 🔎 Search Terms vue ts2322 could be instantiated with an arbitrary type 🕗 Version & Regression Information Versions that exhibits the undesired behavior: 4.6.0-beta, 4.6.1-rc, 4.6.2, ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/48089
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Vue.extend return type error TS2322 with 4.6.2","articleBody":"# Bug Report\r\n\r\n\u003c!--\r\n Please fill in each section completely. Thank you!\r\n-->\r\n\r\n### 🔎 Search Terms\r\n\r\nvue ts2322 could be instantiated with an arbitrary type \r\n\r\n### 🕗 Version & Regression Information\r\n\r\nVersions that exhibits the undesired behavior: 4.6.0-beta, 4.6.1-rc, 4.6.2, next\r\nVersion that works: 4.5.5\r\n\r\n- This changed between versions _4.5.5_ and _4.6.2_\r\n\r\n### ⏯ Playground Link\r\n\r\nThe playground doesn't support 4.6.2 or external packages (Vue in this case) as far as I can see.\r\n\r\n### 💻 Code\r\n\r\npackage.json\r\n\r\n```\r\n{\r\n \"name\": \"vue-ts\",\r\n \"version\": \"1.0.0\",\r\n \"devDependencies\": {\r\n \"typescript\": \"^4.6.2\",\r\n \"vue\": \"^2.6.14\"\r\n }\r\n}\r\n```\r\n\r\ntsconfig.json\r\n\r\n```\r\n{\r\n \"include\": [\r\n \"./src/*.ts\"\r\n ]\r\n}\r\n```\r\n\r\nsrc/file.ts\r\n\r\n```\r\nimport Vue from \"vue\"\r\nimport { ThisTypedComponentOptionsWithRecordProps } from \"vue/types/options\"\r\nimport { ExtendedVue } from \"vue/types/vue\"\r\n\r\nexport function defineComponent\u003c\r\n V extends Vue,\r\n Data,\r\n Methods,\r\n Computed,\r\n Props\r\n >(\r\n options?: ThisTypedComponentOptionsWithRecordProps\u003cV, Data, Methods, Computed, Props>\r\n): ExtendedVue\u003cV, Data, Methods, Computed, Props> {\r\n return Vue.extend(options)\r\n}\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\n4.6.2:\r\n\r\n```\r\n$ npx tsc src/file.ts\r\nsrc/file.ts:13:5 - error TS2322: Type 'ExtendedVue\u003cVue, Data, Methods, Computed, Props>' is not assignable to type 'ExtendedVue\u003cV, Data, Methods, Computed, Props>'.\r\n Type 'Data & Methods & Computed & Props & Vue' is not assignable to type 'Data & Methods & Computed & Props & V & Vue'.\r\n Type 'Data & Methods & Computed & Props & Vue' is not assignable to type 'V'.\r\n 'V' could be instantiated with an arbitrary type which could be unrelated to 'Data & Methods & Computed & Props & Vue'.\r\n\r\n13 return Vue.extend(options)\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n```\r\n\r\nI tried to change to the following, but the result is the same:\r\n\r\n```\r\n V extends Vue & Data & Methods & Computed & Props,\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\n4.5.5:\r\n\r\n```\r\n$ npx tsc src/file.ts\r\n(no error)\r\n```","author":{"url":"https://github.com/provegard","@type":"Person","name":"provegard"},"datePublished":"2022-03-02T20:02:51Z","url":"https://github.com/microsoft/TypeScript/issues/48089"}
| 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:723ebb60-730a-4831-3244-68e0b2e06b8a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B40C:21AC3F:1EA02B8:26C2B7F:6B01493D |
| html-safe-nonce | 938a5f3e037fc01aaacbe0acb9536f7cc4dc0ae22ea4239e80407abcfab078a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDBDOjIxQUMzRjoxRUEwMkI4OjI2QzJCN0Y6NkIwMTQ5M0QiLCJ2aXNpdG9yX2lkIjoiMjEzMDMzMzI3NDE1MTY2ODAyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 67781cd249554e03a56dce3499802f4630bca615aea2f95d81208adc2b9a269e |
| hovercard-subject-tag | issue:1157632552 |
| 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/48089/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b6cfe435793f27a443733e3982485c65e75f88463268f72e0c3c55e464b2ba15/microsoft/TypeScript/issues/48089 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b6cfe435793f27a443733e3982485c65e75f88463268f72e0c3c55e464b2ba15/microsoft/TypeScript/issues/48089 |
| og:image:alt | Bug Report 🔎 Search Terms vue ts2322 could be instantiated with an arbitrary type 🕗 Version & Regression Information Versions that exhibits the undesired behavior: 4.6.0-beta, 4.6.1-rc, 4.6.2, next... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | provegard |
| 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 | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width