Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add types to indicate correct types path #1454

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

muli
Copy link

@muli muli commented Jun 24, 2024

Please check if the PR fulfills these requirements

  • It's the right issue type on the title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has a description of the breaking change

Description

When setting up a brand new React project with TypeScript, I was getting this error:

Could not find a declaration file for module '@toast-ui/react-calendar'. '.../test-react-calendar/node_modules/@toast-ui/react-calendar/dist/toastui-react-calendar.mjs' implicitly has an 'any' type.
  There are types at '.../test-react-calendar/node_modules/@toast-ui/react-calendar/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@toast-ui/react-calendar' library may need to update its package.json or typings.ts(7016)

Which means that you have to include the path to the types file in package.json's export config.


Thank you for your contribution to TOAST UI product. 🎉 😘 ✨

@hungcrush
Copy link

Hi @adhrinae, when you have time, please check it.. It's very important when we using ts...

@kon14
Copy link

kon14 commented Jul 26, 2024

For anyone currently attempting to make of use of existing package releases, you could work around this via explicitly setting the types path in your tsconfig.json:

"compilerOptions": {
  "paths": {
    "@toast-ui/calendar": ["./node_modules/@toast-ui/calendar/types/index.d.ts"],
    "@toast-ui/react-calendar": ["./node_modules/@toast-ui/react-calendar/types/index.d.ts"],
    "@toast-ui/vue-calendar": ["./node_modules/@toast-ui/vue-calendar/types/index.d.ts"]
  }
}

edit: added React/Vue type paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants