You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vue.extend return type error TS2322 with 4.6.2 #48089
import Vue from "vue"
import { ThisTypedComponentOptionsWithRecordProps } from "vue/types/options"
import { ExtendedVue } from "vue/types/vue"
export function defineComponent<
V extends Vue,
Data,
Methods,
Computed,
Props
>(
options?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>
): ExtendedVue<V, Data, Methods, Computed, Props> {
return Vue.extend(options)
}
🙁 Actual behavior
4.6.2:
$ npx tsc src/file.ts
src/file.ts:13:5 - error TS2322: Type 'ExtendedVue<Vue, Data, Methods, Computed, Props>' is not assignable to type 'ExtendedVue<V, Data, Methods, Computed, Props>'.
Type 'Data & Methods & Computed & Props & Vue' is not assignable to type 'Data & Methods & Computed & Props & V & Vue'.
Type 'Data & Methods & Computed & Props & Vue' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'Data & Methods & Computed & Props & Vue'.
13 return Vue.extend(options)
~~~~~~~~~~~~~~~~~~~~~~~~~~
I tried to change to the following, but the result is the same:
V extends Vue & Data & Methods & Computed & Props,
Activity
RyanCavanaugh commentedon Mar 5, 2022
Bisected to #47341
RyanCavanaugh commentedon Mar 5, 2022
Seems like a duplicate of #47371; the PR is associated with a documented breaking change
provegard commentedon Mar 5, 2022
Ok, I see! Is there anything I can do in the definition of
defineComponent, or is the Vue type definition at fault?typescript-bot commentedon Mar 7, 2022
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.