Replies: 1 comment
-
Hello, I'm late to the party but I just figured this one out <script setup lang="ts">
interface Props {
reverse?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
reverse: false
});
</script>
<template>
{{ props.reverse }}
</template> this will give the correct type |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I don't know if this is an issue with the language tools, or Vue, or even expected, but when
"exactOptionalPropertyTypes": true
is set, optional props still have theundefined
value in templates.This is currently an issue for me because some components expect optional props so
(property) reverse?: boolean
, which doesn't work withexactOptionalPropertyTypes
.Using default props also seems to break:
Should I open an issue for this? (Vue 3.3.8 & Volar/vue-tsc 1.8.22)
Beta Was this translation helpful? Give feedback.
All reactions