add2cal / add-to-calendar-button

Reliably create beautiful Add to Calendar Buttons, where people can add events to their calendars. Without the hustle and unsupported cases.
https://add-to-calendar-button.com
Other
1.36k stars 114 forks source link

[Bug]: Could not find a declaration file for module 'add-to-calendar-button' #526

Closed julamb closed 10 months ago

julamb commented 10 months ago

What happened?

I was trying to use atcb_action in a Next.js project with Typescript and import it as follows:

import { atcb_action } from "add-to-calendar-button";

It works but TypeScript does not compile and complains of the following:

Type error: Could not find a declaration file for module 'add-to-calendar-button'. '[...]/node_modules/add-to-calendar-button/dist/module/index.js' implicitly has an 'any' type.
  There are types at '[...]/node_modules/add-to-calendar-button/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'add-to-calendar-button' library may need to update its package.json or typings.

As a workaround, I copied the typings from add-to-calendar-button/index.d.ts and redeclared the module in my own repo.

System & Environment

add-to-calendar-button@2.5.5 typescript@5.2.2

jekuer commented 10 months ago

Will check. If you use Next.js, you could also use the official React Wrapper. It should be more stable in terms of types.

julamb commented 10 months ago

Ok thanks! I could not find atcb_action in add-to-calendar-button-react at first glance, but maybe I didn't look hard enough :)

jekuer commented 10 months ago

ah, you are right. There, we do not export it.

jekuer commented 10 months ago

Thanks for the PR! Release is on the way.

julamb commented 10 months ago

Working perfectly now! Thanks for the quick release, and the great lib :)