Open
Description
Check that this is really a bug
- I confirm
Reproduction link
https://codesandbox.io/p/devbox/dkhjfc?file=%2Fsrc%2FApp.vue%3A10%2C32
Bug description
type SwiperOptions
(import from swiper/types) can't assign Swiper
(import from swiper/vue) as options.
some options are not have null
.
in type definition
swiper/src/types/swiper-options.d.ts
Line 141 in 0c53ee8
so width is number | null | undefined
in component
Line 43 in 0c53ee8
width is number | undefined
Expected Behavior
change to
width: { type: [Number, null] , default: undefined },
Actual Behavior
<script setup lang="ts">
import type { SwiperOptions } from 'swiper/types'
import { Swiper } from 'swiper/vue'
const options: SwiperOptions = {}
</script>
<template>
<div>
<Swiper v-bind="options" />
<!--
Types of property 'width' are incompatible.
Type 'number | null | undefined' is not assignable to type 'number | undefined'.
Type 'null' is not assignable to type 'number | undefined'.
-->
</div>
</template>
Swiper version
"11.2.8"
Platform/Target and Browser Versions
VScode + Vue(Official)
Validations
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
- Make sure this is a Swiper issue and not a framework-specific issue
Would you like to open a PR for this bug?
- I'm willing to open a PR