Subscribe on changes!

关于使用 compiler-sfc 编译 script setup ts 文件的问题

avatar
Aug 27th 2021

Version

3.2.6

Reproduction link

https://gitee.com/ckang1229/vue-next-script-setup-issuse

Steps to reproduce

yarn node build.js

What is expected?

props的type属性是可选的,导致生成dts文件时报错

What is actually happening?

将withDefaults.vue编译成withDefaults.ts后,props的type属性的类型应该不是可选的

avatar
Aug 27th 2021

Could you describe the error in more detail?

avatar
Aug 27th 2021

Use withDefaults to define attributes in script setup, and the type inference is incorrect after compile-sfc is compiled into ts file.

in sfc file in ts file

I think it should not contain optional flags

avatar
Aug 27th 2021

I have the same problem,Please give me a solution

avatar
Aug 27th 2021

Here is a reproducible demo with readme.md attached。please check @ygj6