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

Export all types #455

Closed
alex-mcgovern opened this issue Jun 22, 2024 · 0 comments · Fixed by #459
Closed

Export all types #455

alex-mcgovern opened this issue Jun 22, 2024 · 0 comments · Fixed by #459

Comments

@alex-mcgovern
Copy link
Contributor

alex-mcgovern commented Jun 22, 2024

Describe the feature / bug 📝:

As not all types are exported, in some scenarios, types can't be named, e.g. when re-exporting Sonner as part of a library.

My specific issue arose when using Parcel to output .d.ts type definitions.

This has been reported before in this issue #399

And a fix was attempted in this PR, #400

I'm happy to attempt a fix for this when I have some time. ✌️❤️

Steps to reproduce the bug 🔁:

  1. Bundle Sonner with another library and try to output .d.ts files, e.g.:
    a. Using parcel
    b. Using emit declaration with Typescript compiler

Examples of error output from Parcel:

🚨 Build failed.

@parcel/transformer-typescript-types: Exported variable 'toast' has or
is using name 'Action' from external module
"/Users/{USER}/src/{PACKAGE}/node_modules/sonner/dist/index"
 but cannot be named.

  /Users/{USER}/src/{PACKAGE}/src/toaster/index.tsx:14:14
    13 |  */
  > 14 | export const toast = sonnerToast;
  >    |              ^^^^^ Exported variable 'toast' has or is using name 'Action' from external module "/Users/{USER}/src/{PACKAGE}/node\_modules/sonner/dist/index" but cannot be named.
    15 |
    16 | /**

@parcel/transformer-typescript-types: Exported variable 'toast' has or
is using name 'ToastClassnames' from external module
"/Users/{USER}/src/{PACKAGE}/node_modules/sonner/dist/index"
 but cannot be named.

  /Users/{USER}/src/{PACKAGE}/src/toaster/index.tsx:14:14
    13 |  */
  > 14 | export const toast = sonnerToast;
  >    |              ^^^^^ Exported variable 'toast' has or is using name 'ToastClassnames' from external module "/Users/{USER}/src/{PACKAGE}/node\_modules/sonner/dist/index" but cannot be named.
    15 |
    16 | /**

@parcel/transformer-typescript-types: Exported variable 'toast' has or
is using name 'ToastToDismiss' from external module
"/Users/{USER}/src/{PACKAGE}/node_modules/sonner/dist/index"
 but cannot be named.

  /Users/{USER}/src/{PACKAGE}/src/toaster/index.tsx:14:14
    13 |  */
  > 14 | export const toast = sonnerToast;
  >    |              ^^^^^ Exported variable 'toast' has or is using name 'ToastToDismiss' from external module "/Users/{USER}/src/{PACKAGE}/node\_modules/sonner/dist/index" but cannot be named.
    15 |
    16 | /**
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 a pull request may close this issue.

1 participant