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 ProviderProps interface #20

Open
demeralde opened this issue Aug 31, 2021 · 1 comment · May be fixed by #21
Open

Export ProviderProps interface #20

demeralde opened this issue Aug 31, 2021 · 1 comment · May be fixed by #21

Comments

@demeralde
Copy link

I'm getting this error when building my Bit component library:

Failed task 2: "teambit.compilation/compiler:TSCompiler" of env "cannabitrx.design/tailwind/bit-preview@0.0.10"
component: cannabitrx.design/utils/notification@0.0.1
/home/daniel/Library/Caches/Bit/capsules/ec485f8a915bf25eeb84d81852287b6d7dffac6b/cannabitrx.design_utils_notification@0.0.1/utils.ts:9:9 - error TS4023: Exported variable 'NotificationProvider' has or is using name 'ProviderProps' from external module "/home/daniel/Library/Caches/Bit/capsules/ec485f8a915bf25eeb84d81852287b6d7dffac6b/node_modules/react-notification-provider/dist/index" but cannot be named.

9 const { NotificationProvider, useNotificationQueue, createMockNotificationQueue } =
          ~~~~~~~~~~~~~~~~~~~~

But it works fine during testing/development.

I suspect this is due to some issues in the declaration file for this library?

@davidfirst
Copy link

I started debugging it, and it seems like the interface ProviderProps should be exported.

export interface ProviderProps<Notification> {
    queue?: ImmutableQueue<Notification>;
    children: React.ReactNode;
}

Once I added the export, the error is gone, because now Typescript is able to name the type of the NotificationProvider. Before, it could not.

By the way, the reason why Bit didn't show the error during development is because it doesn't generate declaration files at that stage, only during build. The issue here happens when TS generates the d.ts file.

@demeralde demeralde changed the title TypeScript error during Bit build Export ProviderProps interface Sep 4, 2021
@demeralde demeralde linked a pull request Sep 4, 2021 that will close this issue
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.

2 participants