vuejs / composition-api

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

On the rigor of type checking in volar #940

Closed hexf00 closed 2 years ago

hexf00 commented 2 years ago

A component declared through definecomponent has a defect in type verification.

Perhaps the definition of Data does not apply to all occasions?

I tried to delete the definition of unknown. I found that ComponentPropsOptions still need to accept the generics defined by unknown. Otherwise, the required definition of props will not be recognized, resulting in the attribute being considered optional.

I have explored here for the time being and found no other problems.

Snipaste_2022-05-26_00-59-22

I use https://github.com/johnsoncodehk/volar-starter vue2 branch.

I propose this issue because the Class API or Vue.extend performs better.

Snipaste_2022-05-26_01-07-37

https://github.com/johnsoncodehk/volar/issues/1350#issue-1248417358

This is @vue/composition-api behavior from https://github.com/vuejs/composition-api/blob/032f2c75992043a02a61e05d5f1493d78738ae72/src/component/common.ts#L1.

https://github.com/johnsoncodehk/volar/issues/1350#issuecomment-1140293350

github-actions[bot] commented 2 years ago

Stale issue message

CRMaxime commented 2 years ago

Experiencing the same issue :( this should be reopened.