Replies: 1 comment
-
I use this typing for SolidJS: import "solid-js";
import type { SwiperContainer, SwiperSlide } from "swiper/element";
type Kebabcase<T extends string, A extends string = ""> =
T extends `${infer F}${infer R}` ?
Kebabcase<R, `${A}${F extends Lowercase<F> ? "" : "-"}${Lowercase<F>}`> :
A;
type Kebabprops<T extends object> = {
[K in keyof T as Kebabcase<K>]: T[K];
};
declare module "solid-js" {
namespace JSX {
interface IntrinsicElements {
"swiper-container": JSX.HTMLAttributes<SwiperContainer> & Partial<Kebabprops<Omit<SwiperContainer, "swiper" | "modules" | "on" | "className" | keyof JSX.HTMLAttributes<SwiperContainer>>>>;
"swiper-slide": JSX.HTMLAttributes<SwiperSlide> & Partial<Kebabprops<Omit<SwiperSlide, "swiper" | "className" | keyof JSX.HTMLAttributes<SwiperSlide>>>>;
}
}
} |
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.
-
Hello everyone,
This is my first time using Swiper and coincidently also my first time using Solid.JS seriously to make an MVP. I'm using the latest version of Swiper Element (WebComponent) v11.1.1, along with Solid.JS, Typescript, and TailwindCSS.
After referencing issue #6614 and issue #6466, I was able to resolve the errors with
swiper-container
but I'm still unable to resolve the errors withswiper-slide
.The
swiper-slide
element gives the following errors:This JSX tag's 'children' prop expects type 'HTMLCollection' which requires multiple children, but only a single child was provided.
Type 'import(".../node_modules/.pnpm/solid-js@1.8.11/node_modules/solid-js/types/jsx").JSX.Element' is not assignable to type 'Element'.
While I vaguely understand the second error, I do not know how to solve it. Any help in understanding and resolving the issue is appreciated. Below I have created a custom component, GenericSlider, which is where all the Swiper code is located:
Beta Was this translation helpful? Give feedback.
All reactions