Subscribe on changes!

defineProps 使用 extends 扩展 props 定义类型,导致 props 缺失 extends 的接口类型的属性

avatar
Sep 2nd 2021

Version

3.2.7

Reproduction link

sfc.vuejs.org/

Steps to reproduce

使用类型定义 props 时,当我想通过 extends 扩展 props 的类型,导致 props 的属性并没有被成功扩展,但是 volar 插件能够成功识别到扩展类型的属性定义。

What is expected?

console.log(props) // props { name : undefined, age: 18, gender: male }

What is actually happening?

console.log(props) // props { gender: male }

props 缺失继承的接口类型属性

avatar
Sep 4th 2021

I think this is a limitation, because when the inherited interface is imported from the outside, the complier-sfc does not know what attributes the external interface contains