ui icon indicating copy to clipboard operation
ui copied to clipboard

New Carousel has type errors

Open vicantwin opened this issue 1 year ago • 3 comments

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.

vicantwin avatar Dec 26 '23 18:12 vicantwin

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";

dylanvanh avatar Dec 27 '23 10:12 dylanvanh

The errors still remain.

image

image

vicantwin avatar Dec 28 '23 10:12 vicantwin

@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

davidjerleke avatar Dec 31 '23 16:12 davidjerleke

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!

vicantwin avatar Jan 02 '24 12:01 vicantwin