You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a new Vue 2 + Typescript project with npx vue create
Upgrade project to Vue 2.7 with npm install vue@2.7.14
Set "declaration": true in tsconfig.json
Declare a ref in your component setup whose type argument is a union of a different vue component or null, and set its initial value to null: const helloWorld = ref<InstanceType<typeof HelloWorld> | null>(null);
Return the ref from setup
What is expected?
No error
What is actually happening?
npx vue-tsc --emitDeclarationOnly
src/App.vue:12:1 - error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
12 export default defineComponent({
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 name: 'App',
~~~~~~~~~~~~~~
...
23 }
~~~
24 });
~~~
does not trigger the error, nor does passing an initial value when the type argument does not include another Vue component, e.g.
const xyz = ref<string | undefined>(undefined);
"declaration": true is needed because the repo this issue was discovered in is a shared package that is imported by other Vue applications, and type declarations are required.
This issue does not happen with Vue 2.6 with @vue/composition-api, only 2.7
The text was updated successfully, but these errors were encountered:
Version
2.7.14
Reproduction link
github.com
Steps to reproduce
npx vue create
npm install vue@2.7.14
"declaration": true
intsconfig.json
const helloWorld = ref<InstanceType<typeof HelloWorld> | null>(null);
What is expected?
No error
What is actually happening?
Not passing an initial value, e.g.
does not trigger the error, nor does passing an initial value when the type argument does not include another Vue component, e.g.
"declaration": true
is needed because the repo this issue was discovered in is a shared package that is imported by other Vue applications, and type declarations are required.This issue does not happen with Vue 2.6 with
@vue/composition-api
, only2.7
The text was updated successfully, but these errors were encountered: