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

nullable boolean props not getting undefined union #12098

Open
iammola opened this issue Oct 2, 2024 · 0 comments · May be fixed by #12103
Open

nullable boolean props not getting undefined union #12098

iammola opened this issue Oct 2, 2024 · 0 comments · May be fixed by #12103

Comments

@iammola
Copy link

iammola commented Oct 2, 2024

Vue version

3.5.10

Link to minimal reproduction

https://play.vuejs.org/#eNp9UsFOAjEQ/ZVJL2pC4CAnsmDUcMADEvXYA8vuAMVup9nO4hrcf3e6K4iJ4daZ9/rem2kP6t77/r5CNVJJyErjGQJy5cGmbjPWioNWE+0ycoHhACsii6lblOShgTHkuDYOYxmSP+jd6FjBF1Su4+XQTK5vtEsGnZUIS8FYeJsySgWQbIeTObHJEHiLsDyTXIKPtiYAf3rRSgOIOtbemszwibrsw4whJwzuimGb7kWJYIWRTJ4NudS2Sj3YVTJUoOgLrV1GOUaDjApvLObJQOLEvGcZVU+WIvtYm01/F8jJ5g5RQaufW+Vz6yKLG0GLRCy1lj6e2h6XFfaO/WyL2fs//V2oY0+rRYkByz1qdcI4LTfIHTx9nWMt5xNYUF5ZYV8AXzCQrWLGjvYg7yOxz3ht2lnhqWTjNm9hWjO6cBwqBo3MpuVrJd/n8cLov3Fv+8P2nnaNar4BQJzWTg==

Steps to reproduce

Create a boolean or undefined prop using the defineProps macro.

What is expected?

For the inferred prop type to have undefined as a possible type

What is actually happening?

It strips out the undefined type, leaving only boolean.

System Info

No response

Any additional comments?

I believe it's in

export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
readonly [K in BKeys]-?: boolean
}

Should be fixed by using the original type

export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & { 
  readonly [K in BKeys]-?: T[K]
} 
devTeaa pushed a commit to devTeaa/core that referenced this issue Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants