Closed nickdirienzo closed 3 hours ago
Hey @nickdirienzo 👋 Thanks for catching this!
As I understand, the major version of @types/express
should match express
which is done in #2355. That PR also moves this into devDependencies
since I believe it's used during development of bolt-js
itself and not during app development.
Could you share how you stumbled into this? I'm wondering if it was caused by incompatible @types/express
and express
versions, but haven't run into this myself 🤔
Thanks for jumping on this so quickly @zimeg! I didn't realize @types/express was pinned to ^4, so in our package.json we had it on 5.0.0 because of the express 5 upgrade. It looks like that PR should resolve the typing issue 🙏
What we're seeing in our development experience is we have a function like this:
import { json as JsonMiddleware, type IRouter, Router } from "express";
// This is getting typed with v5
export const setupApiRoutes = (router: IRouter) => {
router.use("/v1", apiRouter);
};
Trying to pass in receiver.router
causes TS to think a v4 Express router is being passed in even though it expects a v5 one... 😅
import { App, ExpressReceiver } from "@slack/bolt";
const receiver = new ExpressReceiver({
signingSecret: env.SLACK_SIGNING_SECRET,
clientId: env.SLACK_CLIENT_ID,
clientSecret: env.SLACK_CLIENT_SECRET,
stateSecret: env.SLACK_STATE_SECRET,
scopes,
installerOptions: {
directInstall: true,
},
installationStore: InstallationStore,
});
// This errors for us in our IDE
setupApiRoutes(receiver.router);
🎉 Thanks so much for sharing this snippet! I can confirm the latest changes fix the compilation error this was causing.
We have a release candidate prepared for the next patch version in #2347 which is undergoing testing now, but I'm hoping to land this change with the next release soon!
So speedy! Thanks for following up on this so quickly!
@slack/bolt
version4.1.1
Your
App
and Receiver ConfigurationN/A
Node.js runtime version
v21.7.3
Steps to reproduce:
Install @slack/bolt latest which installs express v5. The express types are set to ^4 in @slack/bolt's package.json but these aren't aligned with the version of Express being used.
Expected result:
@types/express should be 5.0.0 if Express v5 is used as far as I know.
Actual result:
@types/express v4 is used even though express v5 is installed.
Requirements
For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. :bow:
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.