Closed
Description
Bug is related to
- embla-carousel (core package)
- embla-carousel-react
- embla-carousel-vue
- embla-carousel-svelte
- embla-carousel-autoplay
- embla-carousel-auto-height
- embla-carousel-class-names
Embla Carousel version
- 8.0.0-rc05
Describe the bug
When using node16 esm import in TypeScript, TypeScript with incorrectly flag up the embla-carousel default import as missing. This is due to incorrect typing: https://arethetypeswrong.github.io/?p=embla-carousel%408.0.0-rc05
This error can be ignored using @ts-expect-error
or something similar as I can confirm that the default import does work, it's just the typing that's incorrect.
CodeSandbox
Unfortutately this bug does not occur when usign CodeSandbox. If needed, I can create a simple repository demonstrating this behaviour.
package.json
{
"name": "nodenext",
"type": "module",
"dependencies": {
"embla-carousel": "^8.0.0-rc03",
"typescript": "^5.0.4"
}
}
tsconfig.json
{
"compilerOptions": {
"module": "NodeNext",
}
}
index.ts
import EmblaCarousel from 'embla-carousel';
const carousel = EmblaCarousel();
Steps to reproduce
Simply hover over the EmblaCarousel error in your IDE of choice (mine being VSC)
Expected behavior
I expect the default export to be typed correctly.
Additional context
It seems to be a common issue:
- [NEXT-779] next/* - Typescript cannot find module when moduleResolution=nodenext and type=module vercel/next.js#46078
- Knex typings incompatible with TS 4.7's moduleResolution: NodeNext knex/knex#5358
- TS 4.7.1-rc cannot resolve
default
CJS or ESM exports with modulenodenext
. microsoft/TypeScript#49189