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

Type-only boolean props do not work in production mode #4944

Closed
scottbedard opened this issue Nov 14, 2021 · 1 comment
Closed

Type-only boolean props do not work in production mode #4944

scottbedard opened this issue Nov 14, 2021 · 1 comment

Comments

@scottbedard
Copy link
Contributor

scottbedard commented Nov 14, 2021

Version

3.2.21

Reproduction link

Repo: github.com
Example: https://confident-agnesi-a384b9.netlify.app/

Steps to reproduce

  1. Define a component with a boolean prop using the type-only defineProps syntax.
defineProps<{ checked?: boolean }>()
  1. Render the component using a prop with no value
<Child checked />
  1. Build for production

What is expected?

The child component should be rendered with the prop defined as true. The correct behavior occurs in development mode.

Screen Shot 2021-11-14 at 11 25 59 AM

What is actually happening?

The prop is defined as an empty string and interpreted as false

Screen Shot 2021-11-14 at 11 27 16 AM


It looks like the minified code is not matching what is described in the documentation

In prod mode, the compiler will generate the array format declaration to reduce bundle size (the props here will be compiled into ['foo', 'bar'])

But looking at the dist files, I see props:{checked:null}

@scottbedard
Copy link
Contributor Author

Closing, looks like a duplicate of #4783 and I expect will be fixed with the next patch release.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant