TS2769 error caused when importing lang="js"
component with raw default export on Vue < 2.7
#1517
Labels
enhancement
New feature or request
I found TS2769 error caused when importing
lang="js"
component with raw default export (export default {}
) on Vue < 2.7 (still used in Nuxt apps).src/App.vue
:src/components/HelloWorld.vue
:Error:
This error is caused by type incompatibility between property type of
ComponentOptions<V>['components']
fromvue@2.6.14
and return value ofdefineComponent
from@vue/runtime-dom@3.2.37
.There is a dirty fix that can avoid the error by directly rewriting the code generator in the extension from
@vue/runtime-dom
to@vue/composition-api
as follows (but it doesn't support if@vue/composition-api
is not installed):Before:
https://github.com/johnsoncodehk/volar/blob/b1896bbd0cb23ea35b73ad2c232b0a6832f70939/packages/vue-code-gen/src/generators/script.ts#L211
After:
The text was updated successfully, but these errors were encountered: