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

Typescript "defineProps" removes "Boolean" type in production #4935

Closed
sheremet-va opened this issue Nov 11, 2021 · 1 comment
Closed

Typescript "defineProps" removes "Boolean" type in production #4935

sheremet-va opened this issue Nov 11, 2021 · 1 comment

Comments

@sheremet-va
Copy link

Version

3.2.21

Reproduction link

github.com

Steps to reproduce

Set type "boolean" in the type annotation of "defineProps" macro, like this:

<script setup lang="ts">
defineProps<{ callable?: boolean }>();
</script>

run npm run build command

What is expected?

Component props to be inferred as

props: {
    callable: Boolean, // or {type: Boolean, required: false}
  }

What is actually happening?

Component props is inferred as

props: {
    callable: null,
  }

The reason being is that I can't use callable shortcut on a component instead of :callable="true".

This works in development thought (and was hard to spot on production :)))

@posva
Copy link
Member

posva commented Nov 11, 2021

Duplicate of #4783

@posva posva marked this as a duplicate of #4783 Nov 11, 2021
@posva posva closed this as completed Nov 11, 2021
@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

2 participants