Export all types
alex-mcgovern opened this issue Β· comments
Alex McGovern commented
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 π:
- 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 | /**