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

fix eth packages typing issue, not export default #3198 #3732

Closed
wants to merge 7 commits into from

Conversation

ariesjia
Copy link

Description

Please include a summary of the changes and be sure to follow our Contribution Guidelines.

typing issue, export is not correct.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

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 new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • [ ] I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • [ ] I have updated the CHANGELOG.md file in the root folder.

@coveralls
Copy link

coveralls commented Sep 28, 2020

Coverage Status

Coverage remained the same at 78.042% when pulling e4fa335 on ariesjia:1.x into 9eede51 on ethereum:1.x.

@@ -26,6 +26,7 @@
},
"devDependencies": {
"dtslint": "^3.4.1",
"typescript": "^3.9.5"
"typescript": "^3.9.5",
"web3-eth": "1.3.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this (web3-eth) be a dependency?

@spacesailor24
Copy link
Contributor

So I'm a little confused on why we would want to do something like:

import Contract, { ContractOptions} from 'web3-eth-contract';

If we update the packages, in this case web3-eth-contract, to have the default export be an object containing all the exports such as:

export default {
    Contract,
    ContractOptions
}

You would still be able to do:

import { Contract, ContractOptions} from 'web3-eth-contract';

Am I mistaken, is there a reason you wouldn't want to do it that way?

@ariesjia
Copy link
Author

ariesjia commented Oct 20, 2020

@spacesailor24
The current version the declaration tell us should use import { Contract, ContractOptions } from 'web3-eth-contract'; , but the Contract is got undefined
Because source code is

module.exports = Contract;

for ES module it equals export default. So the typing is not match the source.
If we use import Contract, { ContractOptions } from 'web3-eth-contract';, we will got the correct object , but we will get Typescript compile err due to the declaration.

If we change the export will bring API broken change, this commit is only for quick fix

Copy link

@BryanLaura BryanLaura left a comment

Choose a reason for hiding this comment

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

Fix #3732

Copy link

@BryanLaura BryanLaura left a comment

Choose a reason for hiding this comment

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

export import default

@CLAassistant
Copy link

CLAassistant commented Jan 7, 2021

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ ariesjia
✅ spacesailor24
❌ frankiebee
You have signed the CLA already but the status is still pending? Let us recheck it.

@spacesailor24 spacesailor24 added P3 Low severity bugs Review Needed Maintainer(s) need to review Types Incorrect or missing types labels Mar 9, 2021
@github-actions
Copy link

github-actions bot commented Jun 5, 2021

This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions bot added the Stale Has not received enough activity label Jun 5, 2021
@github-actions github-actions bot closed this Jun 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Low severity bugs Review Needed Maintainer(s) need to review Stale Has not received enough activity Types Incorrect or missing types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants