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

eth.subscribe types improvement #2585

Merged
merged 4 commits into from
Mar 26, 2019
Merged

eth.subscribe types improvement #2585

merged 4 commits into from
Mar 26, 2019

Conversation

nivida
Copy link
Contributor

@nivida nivida commented Mar 26, 2019

Description

Fixes #2583

Type of change

  • Bug fix

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no warnings.
  • I have updated or added types for all modules I've changed
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run test in the root folder with success and extended the tests if necessary.
  • I ran npm run build in the root folder and tested it in the browser and with node.
  • I ran npm run dtslint in the root folder and tested that all my types are correct
  • I have tested my code on an ethereum test network.

@nivida nivida added the Types Incorrect or missing types label Mar 26, 2019
@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.733% when pulling 142f6e7 on issue/2583 into 65d146d on 1.0.

@coveralls
Copy link

coveralls commented Mar 26, 2019

Coverage Status

Coverage remained the same at 95.733% when pulling 0a6d8c9 on issue/2583 into 65d146d on 1.0.

subscribe(type: 'syncing', options?: null, callback?: (error: Error, result: any) => void): Subscription<any>;
subscribe(type: 'newBlockHeaders', options?: null, callback?: (error: Error, blockHeader: BlockHeader) => void): Subscription<BlockHeader>;
subscribe(type: 'pendingTransactions', options?: null, callback?: (error: Error, transactionHash: string) => void): Subscription<string>;
subscribe(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this generic actually loses a lot of good typings for these methods. It before use to map a proper typed single response depending on your type string you supply which is the best kinds of types., the less generic in typings like this the better it is. This will make calling this method super hard in TypeScript world, near impossible to get proper compile time errors.

@nivida nivida merged commit 1e31cc2 into 1.0 Mar 26, 2019
@nivida nivida deleted the issue/2583 branch March 26, 2019 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Types Incorrect or missing types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

web3.eth.subscribe("logs", ..) types issue
3 participants