Skip to content

Commit

Permalink
fix(types): fix instance type inference for setup() with no return value
Browse files Browse the repository at this point in the history
fix #12568
  • Loading branch information
yyx990803 committed Jun 22, 2022
1 parent a122bd2 commit 65531f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions types/test/v3/setup-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ defineComponent({
res?.charAt(1)
}
})

// #12568
const vm = new Vue({
setup() {},
render: h => h({})
})

vm.$mount('#app')
7 changes: 6 additions & 1 deletion types/vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ export type CombinedVueInstance<
Computed,
Props,
SetupBindings
> = Data & Methods & Computed & Props & Instance & SetupBindings
> = Data &
Methods &
Computed &
Props &
Instance &
(SetupBindings extends void ? {} : SetupBindings)

export type ExtendedVue<
Instance extends Vue,
Expand Down

0 comments on commit 65531f5

Please sign in to comment.