Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

missing types for Subscription.on('connected') #3319

Closed
Velenir opened this issue Jan 20, 2020 · 1 comment · Fixed by #3326
Closed

missing types for Subscription.on('connected') #3319

Velenir opened this issue Jan 20, 2020 · 1 comment · Fixed by #3326
Labels
1.x 1.0 related issues Types Incorrect or missing types

Comments

@Velenir
Copy link
Contributor

Velenir commented Jan 20, 2020

Expected behavior

web3.eth.subscribe(<any event type>).on('connected', console.log)

would be properly typed.

Actual behavior

Typescript error No overload matches this call

Steps to reproduce the behavior

1 .Input web3.eth.subscribe('newBlockHeaders').on('connected', console.log)
2. compile with Typescript
3. see error

Versions

Node -- v12.14.1
web3 -- v1.2.4

I think, it should be enough to add on(type: 'connected', handler: (subscriptionId: string) => void): Subscription<T>; to Subscription type declaration.

@nivida
Copy link
Contributor

nivida commented Jan 20, 2020

@Velenir Thanks for opening this issue! We will improve the related types asap.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.x 1.0 related issues Types Incorrect or missing types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants