-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing types in Swiper component because of a missing import in swiper-react.d.ts #6885
Comments
SwiperOptions is definitely there in types/index:
Package types are fully compliant with Node 16+ import syntax https://arethetypeswrong.github.io/?p=swiper%4010.0.4 |
If everything is all right, so why we have this TS error both in my enviroment and in Stackblitz (that sure is not my env)
And, when I do the changes I told u in this thread types start working normally? |
I can confirm - build fails on import of I use Next.js Error:
My
@nolimits4web are you sure ticket should be closed? |
moduleResolution should be set to nodenext |
Dude, I love ur slider and this lib, But I already tried "node16" and "nodenext". The issue keep happing to me, both in my env and in Stackblitz. And In
Edit: type module in package.json json solve this error, but still, types are missing in Swiper component I update Stackblitz URL so u can see what's happening. Just take a look By the way, this example is in React, but my project where I found the issue in the first time it's also in NextJS and If you just remove the d.ts from the paths, everything goes back to normal. Without needing to change moduleResolution in tsconfig. |
I can confirm that this problem exists. I'm updating an old react app which was using 8.xx version of Slider, and I've got the exact same error My tsconfig
I've tried different module resolution settings, the same error persists. In the end I've decided that the latest 9.x version is good enough already. |
@nolimits4web seems like the problem is not resolved :/ |
Check that this is really a bug
Reproduction link
https://github.com/josedasilva123/yourself-website/blob/main/src/components/sections/ImageSliderSection/ImageSliderSection.tsx
https://stackblitz.com/edit/stackblitz-starters-qtpgv7?file=src%2FApp.tsx (you can see the type error in that link)
Bug description
Swiper component type is not working because, some imports in swiper-react.d.ts are wrong.
Expected Behavior
Should be like this, this small fix solves the issue.
Another way to solve the issue that i found was to remove the d.ts from every single import (they are not necessary) and when I did that, it also solves the issue without the needing of change any import.
(Like this, but, there is also some imports that are breaking because of the d.ts so I made in every d.ts file ) and every start working perfectly.
I don't know if there is a better way to fix it, but this is working
Actual Behavior
import type { SwiperOptions, Swiper as SwiperClass } from '../types/index.d.ts';
There is no SwiperOptions in index file, and also, d.ts is not necessary in the importing path. For some reason, the * export are not working :c
Swiper version
10.0.4
Platform/Target and Browser Versions
The problem in not in a browser is VSCode, because is a TS problem
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: