'How do I find the appropriate TypeScript type for a given function signature in a third party package?
I want to learn TypeScript but may be punching too far above my weight. I'm attempting to use Slacks BoltJS library and all is good in regular JS but I'm stuck at step one WRT TypeScript. As a general question how would I take a normal JS method signature and convert it to its appropriate type(s) from a third party library?
Here's the method signature I'm currently looking at converting:
app.event('app_home_opened', async (event, client, context) => { });
I looked through node_modules/@slack/bolt/dist/types essentially for a type that centered around events and that contained at least event, client, and context as instance variables. I tried BasicSlackEvent, BasicSlackEvent<'AppHomeOpenedEvent'>, SlackEventMiddlewareArgs<'AppHomeOpenedEvent'> and a few others.
I want to solve this for the above case but the question is more general. Is there an easier way to convert a plain JS signature to its TypeScript equivalent?
I'm using VSCode and there is definitely some linting going on but I don't think I'm providing enough context for VSCode to help me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
