Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
code-farmer-i opened this issue Aug 27, 2021 · 4 comments · Fixed by #4466
Closed

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

code-farmer-i opened this issue Aug 27, 2021 · 4 comments · Fixed by #4466

Comments

@code-farmer-i
Copy link

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属性的类型应该不是可选的

@ygj6
Copy link
Member

ygj6 commented Aug 27, 2021

Could you describe the error in more detail?

@code-farmer-i
Copy link
Author

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

@LongJinCen
Copy link

I have the same problem,Please give me a solution

@LongJinCen
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants