vuejs / composition-api

Composition API plugin for Vue 2
https://composition-api.vuejs.org/
MIT License
4.19k stars 343 forks source link

Issue seeing when reusing composable #917

Closed anish714 closed 2 years ago

anish714 commented 2 years ago

Reusable composable: ` import { defineComponent, reactive, ref, toRefs } from "@vue/composition-api";

const userConfiguration = defineComponent({ name: "abc", props: {}, setup() { const val = ref(""); const breweries = reactive({ list: [] }); const submitted = async () => { console.log("submitted called"); }; return { val, ...toRefs(breweries), submitted }; }, // type inference enabled });

export { userConfiguration };`

In component:

setup() { const state = reactive({ name: "Link", }); const { val } = userConfiguration(); }

Gives this error: Value of type 'VueProxy<{}, { submitted: () => Promise; list: Ref<never[]>; val: Ref; }, Data, {}, {}, {}, {}, {}>' is not callable. Did you mean to include 'new'?Vetur(2348)

When using Typescript and Vue Class Component

github-actions[bot] commented 2 years ago

Stale issue message