unplugin-vue-components icon indicating copy to clipboard operation
unplugin-vue-components copied to clipboard

Vue 2.7 components.d.ts module augmentation

Open jfrs opened this issue 2 years ago • 2 comments

Vue 2.7 no longer needs @vue/runtime-core, which means that the generated components.d.ts isn't recognised by Volar.

I've replaced

import '@vue/runtime-core'

export {}

declare module '@vue/runtime-core' {

with

export {}

declare module 'vue' {

and that fixes the issue.

I don't know if we can autodetect the version, otherwise maybe an option to override the module used here?

jfrs avatar Jul 16 '22 19:07 jfrs

me too

liwangyong avatar Aug 11 '22 09:08 liwangyong

This issue causes type inference to fail in Vue 2.7

TylerOliver avatar Aug 19 '22 14:08 TylerOliver

Is there something I can provide to help this get worked on? Type inference is totally broken in Vue 2.7 without manually editing the generated file.

TylerOliver avatar Sep 26 '22 14:09 TylerOliver

Using option 2.7 seemingly had no affect for me. The process did not work correctly. Pushing the option back to '2', from '2.7', had no affect either. I was only able to get it to function properly by explicitly adding @vue/runtime-core & pushing back to the 2 option. Otherwise volar was not able to infer the types.

VividLemon avatar Feb 23 '23 20:02 VividLemon