unplugin / unplugin-vue2-script-setup

💡 Bring `<script setup>` to Vue 2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to define props with defaults partially

iamrgroot opened this issue · comments

Hi, I'm not sure if this is the right place, but let me know if it is not.

I have the following component setup:
image

And I use it like this:
image

I'm getting the following TS error:
Type '{ value: string; }' is not assignable to type 'IntrinsicAttributes & Partial<{}> & Omit<Readonly<ExtractPropTypes<__VLS_DefinePropsToOptions<Props>>> & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>'. Property 'label' is missing in type '{ value: string; }' but required in type 'Omit<Readonly<ExtractPropTypes<__VLS_DefinePropsToOptions<Props>>> & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>'.

I would have thought that the withDefaults would allow me to omit the label property. It seems to be working fine, with the error there, but I would like the error removed.

Am I missing some syntax or am I misunderstanding the withDefaults?

I have a repo setup here https://github.com/IAmRGroot/script-setup-typed-props

It's volar's bug.

see vuejs/language-tools#868

fixed in v0.31.1