ui
ui copied to clipboard
New Carousel has type errors
Although the carousel works in dev without any errors, the file itself has multiple errors. Because of this, I am unable to build.
the error:
Type 'number' is not assignable to type 'AlignmentOptionType | undefined'.
55 | ) => {
56 | const [carouselRef, api] = useEmblaCarousel(
> 57 | {
| ^
58 | ...opts,
59 | axis: orientation === "horizontal" ? "x" : "y",
60 | },
error: script "build" exited with code 1 (SIGHUP)
This is the topmost error. There are other errors as well. I've tried using the cli again for the carousel and the files from this repo's registry, both produces the same errors.
I'm using NextJS 14.0.4, and Embla Carousel ^8.0.0-rc17.
See this issue.
Solution:
+ import {
+ type EmblaCarouselType as CarouselApi,
+ type EmblaOptionsType as CarouselOptions,
+ type EmblaPluginType as CarouselPlugin,
+ } from "embla-carousel";
+ import useEmblaCarousel from "embla-carousel-react";
- import useEmblaCarousel, {
- type EmblaCarouselType as CarouselApi,
- type EmblaOptionsType as CarouselOptions,
- type EmblaPluginType as CarouselPlugin,
- } from "embla-carousel-react";
The errors still remain.
@vicantwin screenshots with fragments of code are impossible to debug. Please provide a GitHub repository with a reduced test case (unnecessary details stripped) and instructions on how to reproduce the problem.
Best, David
Weirdly enough, this issue doesn't occur on a new project. I'm not sure what causes the errors, and since it occurs on both vscode and nvim, I believe its an issue with my project's tsconfig or something of the like.
Thank you for your attention and support @davidjerleke and @dylanvanh!