Open
Description
Describe the bug
Most of the BootstrapVueNext
component props are marked as optional, but the type definition is missing undefined
. This prevents the value undefined
from actually being passed to the props when exactOptionalPropertyTypes
is enabled, which limits some usage scenarios. For example, this is not allowed:
<template>
<BFormGroup :invalid-feedback="invalidFeedback"></BFormGroup>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const invalidFeedback = ref<string>();
</script>
vue-tsc
reports the following type error:
src/App.vue:2:4 - error TS2379: Argument of type '{ invalidFeedback: string | undefined; }' is not assignable to parameter of type '{ readonly contentCols?: boolean | Numberish; readonly labelCols?: boolean | Numberish; readonly labelAlign?: string; readonly ariaInvalid?: AriaInvalid; ... 26 more ...; readonly labelAlignXl?: string; } & VNodeProps & AllowedComponentProps & ComponentCustomProps & Record<...>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Type '{ invalidFeedback: string | undefined; }' is not assignable to type '{ readonly contentCols?: boolean | Numberish; readonly labelCols?: boolean | Numberish; readonly labelAlign?: string; readonly ariaInvalid?: AriaInvalid; ... 26 more ...; readonly labelAlignXl?: string; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'invalidFeedback' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
2 <BFormGroup :invalid-feedback="invalidFeedback"></BFormGroup>
Reproduction
https://stackblitz.com/edit/github-8kyt3tva?file=src%2FApp.vue&view=editor
Used Package Manager
pnpm