question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

app.message payload arg compatibility in TypeScript

See original GitHub issue

The message argument in app.message listeners does not provide sufficient properties in TypeScript.

Property ‘user’ does not exist on type ‘KnownEventFromType<“message”>’. Property ‘user’ does not exist on type ‘MessageChangedEvent’.ts(2339)

A workaround is to cast the message value by (message as GenericMessageEvent).user but needless to say, this is not great.


I ran into this today also. Trying to use the official example from https://slack.dev/bolt-js/concepts

// This will match any message that contains 👋
app.message(':wave:', async ({ message, say }) => {
  await say(`Hello, <@${message.user}>`);
});

and immediately getting a ts compile error. This is not a great first-time experience. Not even sure how to get it working.

_Originally posted by @memark in https://github.com/slackapi/bolt-js/issues/826#issuecomment-830565064_

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:10
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

20reactions
maksimfcommented, Apr 12, 2022

It’s a pity to see that after a year since this issue has been created we still don’t have a ts support of the very basic example in the README 😕

12reactions
verveguycommented, Feb 8, 2022

My advice: don’t bother trying to use Bolt with Typescript at this point. Perhaps one day slack will genuinely prioritize Typescript.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - TypeScript 4.6
In a structural type system, object types are compatible based on the members they have. ts. interface Source {. prop: string ...
Read more >
TypeScript - Fastify
npm init -y npm i fastify npm i -D typescript @types/node ... When you want to use it for validation of some payload...
Read more >
Announcing TypeScript 4.6 - Microsoft Developer Blogs
type Action = | { kind: "NumberContents", payload: number } | { kind: "StringContents", payload: string }; function processAction(action: Action) ...
Read more >
How to type Redux actions and Redux reducers in TypeScript?
state, message: action.payload, }; }) // action.payload type is `void` by default when adding reducer function using `addReducer(actionType: string, ...
Read more >
TypeScript errors and how to fix them
error TS1055: Type ' AxiosPromise ' is not a valid async function return type in ES5/ES3 because it does not refer to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found