Subscribe on changes!

In typescript, defineProps doesn't implement interfaces that extends other interfaces properties

avatar
Mar 9th 2022

Version

3.2.31

Reproduction link

sfc.vuejs.org/

Steps to reproduce

Prerequisities : Use typescript, the composition API and defineProps as a generic function. Steps : 1 - Create a composable with external props that will be used in multiple components. 2 - Create two components that have unique props AND shared props. 2.1 - The unique props will be implemented as an interface. 2.2 - The shared props will be implemented as an extension of that interface. 3 - Create a page that will import both component and use the shared props.

You can see that the shared props aren't managed by vue.

What is expected?

The shared props should be managed by the defineProps and the withDefaults functions.

What is actually happening?

The shared props aren't triggered and doesn't work.


This seems to be a type error as typescript interface extension should be triggered as the typescript interface props. There must be the same error for the defineEmits but I haven't tried it yet.

avatar
Mar 9th 2022

This seems to be related to this issue: https://github.com/vuejs/core/issues/4294

avatar
Mar 9th 2022

Yes. Same limitation applies. If we solve 4294, this will be solved as well.