-
Notifications
You must be signed in to change notification settings - Fork 662
Migration Guide for web‐api v7
This migration guide helps you transition an application written using the v6.x
series of the @slack/web-api
package to the v7.x
series. This guide focuses specifically on the breaking changes to help get your existing app up and running as
quickly as possible.
- (todo: link to release notes) Learn about all the new features in our
v7.0.0
release notes.
This release focusses on the type safety of Slack HTTP API method arguments provided by @slack/web-api
.
This release broadly is composed of three significant changes to the web-api
codebase:
- 🚨 Breaking changes to API method arguments,
- 📝 Adding a ton of new hand-written JSDocs to provide useful method-specific context and descriptions directly in your IDE, and
- 🧑🔬 Type tests for method arguments, formalizing some of the co-dependencies and constraints unique to specific API methods
Let's dive into these three sets of changes and begin with the 🚨 Breaking Changes 🚨 to make sure we set you all up for success and an easy migration to v7.
Previously, the arguments provided to specific methods extended from a WebAPICallOptions
TypeScript interface.
This interface made all API arguments effectively type un-safe: you could place whatever properties you wanted on arguments, and
the TypeScript compiler would be fine with it.
In v7, in an attempt to improve type safety, we have removed this argument. As a result, if you were using unknown or publicly undocumented API arguments, you will now see a TypeScript compiler error. If you really want to send unsupported arguments to our APIs, you will have to tell TypeScript "no, trust me, I really want to do this" using the // @ts-expect-error
directive.
If you find an issue with any of our method arguments, please let us know by filing an issue in this project!
A full and detailed list follows, with migration steps where applicable.
This change ties into closely with the third change discussed above (3. 🧑🔬 Type tests for method arguments), as all of these constraints are exhaustively tested under test/types/methods
. When in doubt, read these tests to understand exactly what combination of arguments are expected to raise a TypeScript error, and which ones are not.
- TODO: document all the method changes 🤪