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

SlackEventAdapter does not have type 'on' #948

Closed
6 of 15 tasks
andrewyalung opened this issue Jan 28, 2020 · 6 comments
Closed
6 of 15 tasks

SlackEventAdapter does not have type 'on' #948

andrewyalung opened this issue Jan 28, 2020 · 6 comments
Assignees
Labels
pkg:events-api (deprecated) applies to `@slack/events-api`

Comments

@andrewyalung
Copy link

Description

I'm attempting to switch to using @slack/events-api with TypeScript and seem to be running into an error that is stating Property 'on' does not exist on type 'SlackEventAdapter' when trying to set up the event handling.

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

  • bug
  • enhancement (feature request)
  • question
  • documentation 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.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/events-api
  • @slack/interactive-messages
  • @slack/rtm-api
  • @slack/webhooks
  • I don't know

Reproducible in:

package version: 2.3.1

node version: 12.13.1

OS version(s): Mac OSX

Steps to reproduce:

  1. import createEventAdapter using import { createEventAdapter } from '@slack/events-api'
  2. set up the createEventAdapter using const adapter = createEventAdapter(signingSecret)
  3. type adapter.on('link_shared', (event) => console.log(event)) and see the typescript error

Expected result: There to be no typescript errors

Actual result: Typescript error listed above.

Attachments:

Screen Shot 2020-01-28 at 1 10 00 PM

@seratch seratch added the pkg:events-api (deprecated) applies to `@slack/events-api` label Jan 30, 2020
@jwulf
Copy link

jwulf commented Feb 5, 2020

Here is my workaround atm:

const slackEvents: SlackEventAdapter & EventEmitter = createEventAdapter(
  slackSigningSecret
) as any;

@jwulf
Copy link

jwulf commented Feb 12, 2020

This is due to a change in the types for Node 13 (see here). Installing @types/[email protected] in my project fixes this for me.

@net8floz
Copy link

net8floz commented Mar 1, 2020

would love a fix for this. I see there's a PR in another issue that fixes this. The issue is that event emitter and http have no default import. The PR looks like it just needs a reviewer to approve it. Thanks for the work on this repo.

@stevengill
Copy link
Member

@net8floz you are right. I believe #958 fixed this problem. I'm going to close this issue and aim to get a release out today/tomorrow with the fix.

@garyposter
Copy link

I'm on node 14 and seeing this. Is there a fix planned before Node 14 becomes current, October 20? Or perhaps this is unique to me?

@saini-g
Copy link

saini-g commented Dec 7, 2020

I'm also facing this problem and installed the @types/[email protected] package as a dev dependency to get rid of the error.
Is there any plan to fix the problem for the latest node type definitions??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:events-api (deprecated) applies to `@slack/events-api`
Projects
None yet
Development

No branches or pull requests

7 participants