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

error TS2308: Module './types' has already exported a member named 'X' #2233

Closed
pascal-sidlee opened this issue Sep 4, 2024 · 8 comments
Closed
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented TypeScript-specific

Comments

@pascal-sidlee
Copy link

pascal-sidlee commented Sep 4, 2024

@slack/bolt version

3.21.1

Your App and Receiver Configuration

const app = new App({
token: process.env.SLACK_BOT_TOKEN,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
logger: logger,
});

Node.js runtime version

18.17.0 64-bit

Steps to reproduce:

(Share the commands to run, source code, and project settings)

  1. npm install
  2. npm run start

Expected result:

Get all packages without any issues et build the app

Actual result:

Got 105 errors, like these:

node_modules/@slack/bolt/dist/index.d.ts:18:1 - error TS2308: Module './types' has already exported a member named 'WorkflowStepDeletedEvent'. Consider explicitly re-exporting to resolve the ambiguity.

18 export * from '@slack/types';
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@slack/bolt/dist/index.d.ts:18:1 - error TS2308: Module './types' has already exported a member named 'WorkflowStepExecuteEvent'. Consider explicitly re-exporting to resolve the ambiguity.

18 export * from '@slack/types';
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@slack/bolt/dist/index.d.ts:18:1 - error TS2308: Module './types' has already exported a member named 'WorkflowUnpublishedEvent'. Consider explicitly re-exporting to resolve the ambiguity.

18 export * from '@slack/types';

Requirements

@pascal-sidlee
Copy link
Author

pascal-sidlee commented Sep 5, 2024

Weird issue, I tried to come back to the last successful version 3.18.0, and same issue now since the 29th august. No versions works now, event the old ones.

No packages were upgraded during this time.

@pascal-sidlee
Copy link
Author

If we are using typescript, the issue comes from the file @slack/bolt/types/dist/index.d.ts, line 18.
If I specify only types I need and they are not duplicate, the site is compiling successfully.

image

@filmaj filmaj added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented TypeScript-specific and removed untriaged labels Sep 5, 2024
@filmaj
Copy link
Contributor

filmaj commented Sep 5, 2024

Indeed there is a problem here. As per #2234 , this can be easily reproduced by:

git clone https://github.com/slackapi/bolt-js.git
cd bolt-js/examples/getting-started-typescript
npm i
npm run build

I believe it is due to the change I made where I took the event payloads that were a part of bolt-js and exposed them in the @slack/types repo (see abbe82c). Since bolt-js uses a floating version specifier for @slack/types, existing bolt apps would pull in this new types package, which includes the event payloads, but have the existing bolt-js repo also include the event payloads, leading to this error.

Possibly all that is needed is a new release of bolt-js. I am investigating. I will also add an integration test w/ the typescript example within this repo to ensure no regressions.

Sorry for the trouble 😢

@filmaj
Copy link
Contributor

filmaj commented Sep 5, 2024

I am able to avoid this problem with the latest main commit, at least in the packaged examples/getting-started-typescript app, by npm linking @slack/bolt to it. This tells me the latest main does not have this problem. This makes sense to me as the latest main of bolt-js simply re-exports the @slack/types interfaces, so only one source (types) is exporting the types causing this issue.

I will create a PR to update this sample and add a basic integration test between this sample and the main repo as part of GitHub Action CI to help prevent regressions like this in the future. Once this is merged, I can then cut a new release of bolt-js which should fix the issue.

I will also implement a similar integration test between the various @slack/* modules that bolt-js relies on over in the https://github.com/slackapi/node-slack-sdk project. That kind of test would have at least caught this problem when I went to make the change in the types package last week.

I'll update this issue once a new version of bolt-js is live.

@filmaj
Copy link
Contributor

filmaj commented Sep 5, 2024

bolt v3.21.2 is live on npm. Can someone see if this fixes the issue for them? @pascal-sidlee @yoychen

@pascal-sidlee
Copy link
Author

Excellent, that fixed my issue, thanks!

@filmaj
Copy link
Contributor

filmaj commented Sep 5, 2024

Great, thanks for confirming! Closing now, but feel free to re-open or open a new one if anything else arises.

@filmaj filmaj closed this as completed Sep 5, 2024
@yoychen
Copy link

yoychen commented Sep 6, 2024

bolt v3.21.2 is live on npm. Can someone see if this fixes the issue for them? @pascal-sidlee @yoychen

It works, thanks!!! 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented TypeScript-specific
Projects
None yet
Development

No branches or pull requests

3 participants