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

next() is optional in middleware in TypeScript #1098

Closed
4 of 10 tasks
seratch opened this issue Aug 30, 2021 · 0 comments · Fixed by #1099
Closed
4 of 10 tasks

next() is optional in middleware in TypeScript #1098

seratch opened this issue Aug 30, 2021 · 0 comments · Fixed by #1099

Comments

@seratch
Copy link
Member

seratch commented Aug 30, 2021

Description

For all middleware functions, next argument exists for sure. However, the types in bolt-js has not been representing that. As the argument is always optional, developers using TypeScript have to call the method with !.

app.use(async ({ next }) => {
  await next!();
});

The type definition: https://github.com/slackapi/bolt-js/blob/%40slack/bolt%403.6.0/src/types/middleware.ts#L24-L25
Examples: https://github.com/slackapi/bolt-js/blob/%40slack/bolt%403.6.0/src/App.spec.ts#L428-L431

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant