-
Notifications
You must be signed in to change notification settings - Fork 399
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
Developer experience building Slack apps with Bolt using TypeScript #826
Comments
Hi @byrondover! Thanks for surfacing this issue and doing such a thorough job with providing support and reasoning behind it. The maintainers have unanimously agreed to prioritize this topic in our next meeting, so I'll circle back around with more details once we've had time to discuss it. In the meantime, we hear you and agree that there's work to be done in order to better the experience here! |
Related to this, Can we get I have struggled a lot in the last couple of days figuring the types and way this works and it's been hard with the current state of docs! |
The changes in slackapi/node-slack-sdk#1188 are also related to this topic. |
In the PR #832 , I've added a few TODO/FIXME comments in the type tests. If someone is interested in resolving them without breaking changes, it'd be greatly appreciated: https://github.com/slackapi/bolt-js/pull/832/files |
@byrondover Like @misscoded said, thanks for starting this conversation! I think we knew that types support was lacking in Bolt, but you've comprehensively laid out the larger picture which gives us a starting point to begin making immediate improvements 🙇 EDIT: Apologies for how long that comment is—I need to work on shortening my replies 😅
Yes 💯 TypeScript should add value and feel like the default Bolt developer experience. To get there, there are are quite a few areas to explore, some easier than others. It may be valuable to start with a few lower lift, short-term issues (most of which you've mentioned):
Longer term we could consider outlining what a larger refactor of Bolt types might look like, especially considering newer platform features and the deprecation of older ones. Hopefully clearly reworking, exposing, and documenting types would also make Bolt's more advanced features (like custom middleware and context objects) more approachable.
Yes! I think you're right that we should write the Using TypeScript guide, and it could be a great opportunity to also show why coding with TypeScript can (and should) be so beneficial long-term. I've created #850 to address this. For other documentation, I think it would also be great to explore what a toggle may look like to include both TypeScript and plain JavaScript examples throughout the basic and advanced concepts. This will be a bit more work, but once we have more code examples it will become a lot easier.
Bringing this up is already helping! 😄 But of course we appreciate any contributions going forward. I'm going to try to do some work to open tickets and create some basic examples. When some basic pieces are in place, you could either help with those tickets or contribute code samples which are probably highest value for developers landing on Bolt for the first time. 🏁 I began work with #845, which includes a TypeScript version of the getting started guide. It's not perfect, but it's a starting point and exposes some easy improvements (like refining message types). In that PR, I've also included some of the basic section examples and will continue to add more over time. When I have some free time I'd like to finish up those examples and then shift to making small but helpful type improvements and writing a draft of the Using TypeScript guide. When I have a draft of that, I'll tag you in the PR and if you have time I'd love your review (if not, that's completely fine and understandable). I'm familiar with TypeScript, but not an expert by any means. 👀 If you (or anyone else reading this) see any obvious gaps I'm missing to improve support please let me know so that it can guide our prioritization. And if you're interested in contributing to anything specifically I'm happy to work with you on it in any way that's helpful. |
I ran into this today also. Trying to use the official example from https://slack.dev/bolt-js/concepts
and immediately getting a ts compile error. This is not a great first-time experience. Not even sure how to get it working. |
@memark We are sorry about the insufficient support for TypeScript as of today. I've confirmed the issue and created a new ticket for the problem you've reported. Thank you very much for reporting the issue. |
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. |
As we are tracking the progress of this issue at #904, let us close this one. Thanks again for taking the time to report this! |
Description
Bolt's current TypeScript implementation serves to slow down rather than speed up the developer experience. There is little useful documentation to help developers who wish to write Slack apps in TypeScript.
What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)Discussion
Currently, Bolt SDK typings are optimized for SDK developers and contributors. They are not naively applicable to end users of the Bolt SDK, which can make writing Bolt apps in TypeScript today prohibitively difficult.
Here are a few recent examples:
subtype
message pattern filter formessage
handlers #796I have seen a few answers from @seratch, who does an admirable job of providing workarounds and specialized solutions. 🙏 However, these recommendations often feel like increased complexity, and they are not intuitive to SDK end users. TypeScript is not at fault here; the Bolt type system implementation does not support even naive supersets of the JavaScript SDK. For example:
TypeScript is intended to extend JavaScript by adding types to the language, and speed up the development experience by catching errors and providing fixes.
Writing Slack apps in with Bolt in TypeScript today actually slows down the developer experience, and feels more like an exercise in reverse engineering the SDK than it does in creating awesome new Slack apps.
Questions:
Reproducible in:
package version: @slack/bolt >= 2.5.0
typescript version: typescript >= 4.1.0
Steps to reproduce:
Expected result:
Slack app to naively transpile and start successfully:
Actual result:
Typing errors plague the developer experience.
Attachments:
Here's a sample project, for reference:
https://github.com/byrondover/slack-bolt-quickstart-typescript
The text was updated successfully, but these errors were encountered: