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
After initializing a new Vue 2.7 project using the new Vite Vue 2 plugin with Volar take-over mode enabled, defining a setup() function in the root Vue instance changes the return type to never, leading to calling .$mount('#app') displaying a type error both in VSCode and when running vue-tsc.
newVue({
router,render: (h)=>h(App)// No issues}).$mount('#app');
newVue({
router,setup(){provide('test','value');},render: (h)=>h(App)// Property '$mount' does not exist on type 'never'.}).$mount('#app');
Happening both under TypeScript version 4.6.4 and 4.7.4.
What is expected?
Defining a setup function in the root instance works without changing the return type to never.
What is actually happening?
Using setup in the root displays a type error when trying to call $mount().
I believe everything is working fine in runtime, purely a TypeScript issue from what I can tell.
EDIT: Some additional info, I found that returning an empty object can work around this issue:
newVue({
router,setup(){provide('test','value');return{};},render: (h)=>h(App)// No issues}).$mount('#app');
The text was updated successfully, but these errors were encountered:
Version
2.7.0-beta.4
Reproduction link
github.com
Steps to reproduce
After initializing a new Vue 2.7 project using the new Vite Vue 2 plugin with Volar take-over mode enabled, defining a
setup()
function in the root Vue instance changes the return type tonever
, leading to calling.$mount('#app')
displaying a type error both in VSCode and when runningvue-tsc
.Happening both under TypeScript version 4.6.4 and 4.7.4.
What is expected?
Defining a setup function in the root instance works without changing the return type to
never
.What is actually happening?
Using setup in the root displays a type error when trying to call
$mount()
.I believe everything is working fine in runtime, purely a TypeScript issue from what I can tell.
EDIT: Some additional info, I found that returning an empty object can work around this issue:
The text was updated successfully, but these errors were encountered: