Typescript "defineProps" removes "Boolean" type in production
Version
3.2.21
Reproduction link
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 :)))
Duplicate of https://github.com/vuejs/vue-next/issues/4783