Subscribe on changes!

vue3 typescript question, ts(2305) error

avatar
Feb 24th 2021

Version

3.0.5

Reproduction link

https://github.com/lovetingyuan/vue3-ts-error

Steps to reproduce

git clone and yarn

shims-vue.d.ts will report the error: module “"../node_modules/vue/dist/vue"” has no exported member “DefineComponent”. ts(2305)

What is expected?

I am not clear the reason of the mistake, I think there should be no error.

What is actually happening?

shims-vue.d.ts will report the error: module “"../node_modules/vue/dist/vue"” has no exported member “DefineComponent”. ts(2305)

avatar
Feb 24th 2021

That happens because you also do declare module '@vue/runtime-core' in that declaration file, essentially nullifying all type definitions that are provided by that package.

Move that declaration into a plain .ts file (i.e. main.ts) and it works.

avatar
Feb 24th 2021

ok, thanks a lot.