You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Importing modules since v10 doesn't work as expected when using typescript.
Importing from swiper gives a runtime error. E.g import { Navigation } from 'swiper';
Importing from swiper/modules gives a typescript error. E.g import { Navigation } from 'swiper/modules';
Expected Behavior
I expect that the import from swiper either doesn't work anymore, or no runtime error is being thrown.
Also, the import from swiper/modules shouldn't give a typescript error.
Actual Behavior
I'm having issues while trying to import modules. It looks like that the modules have to be imported from swiper/modules since v10, but this gives a typescript error:
import{Navigation}from'swiper/modules';
^ gives: Cannot find module 'swiper/modules' or its corresponding type declarations.
Importing from swiper directly works at first sight, but then a runtime error is thrown:
import{Navigation}from'swiper';
^ gives this error when trying to render the swiper:
ran into the same error category (but import SwiperOptions, Swiper)- quick fixed by import { SwiperOptions, Swiper } from './types/index.d'; (without .ts)
Check that this is really a bug
Reproduction link
https://github.com/GiyoMoon/swiper-modules-error
Bug description
Importing modules since v10 doesn't work as expected when using typescript.
swiper
gives a runtime error. E.gimport { Navigation } from 'swiper';
swiper/modules
gives a typescript error. E.gimport { Navigation } from 'swiper/modules';
Expected Behavior
I expect that the import from
swiper
either doesn't work anymore, or no runtime error is being thrown.Also, the import from
swiper/modules
shouldn't give a typescript error.Actual Behavior
I'm having issues while trying to import modules. It looks like that the modules have to be imported from
swiper/modules
since v10, but this gives a typescript error:^ gives:
Cannot find module 'swiper/modules' or its corresponding type declarations.
Importing from
swiper
directly works at first sight, but then a runtime error is thrown:^ gives this error when trying to render the swiper:
Swiper version
10.0.1
Platform/Target and Browser Versions
Chrome
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: