-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Use regular functions and not arrow functions in the index.js file of the modules. #2503
Comments
First I had such factory methods in each index.js but I've removed them because it would break the API for the standalone modules. This will get improved with the implementation of the Edit: |
Maybe then for the sake of explicitness simply using regular/ES5 functions as they can act as classes. |
Yes, right I will improve this later. Currently, there are issues with a higher priority. :) |
Changed this issue label to bug because it does not work with the arrow methods if you use a submodule module. |
https://github.com/ethereum/web3.js/blob/5023c450a783b892da862712e0d8dc26cddba4ab/packages/web3-eth/src/index.js#L76
https://github.com/ethereum/web3.js/blob/5023c450a783b892da862712e0d8dc26cddba4ab/packages/web3-eth/src/index.js#L87
In a clean not-transpiled environment such code will give you
TransactionSigner is not a constructor
error as arrow function cannot be acting as a class constructor::It's currently only working probably because Babel transpiles arrow functions to a regular/ES5 functions which can be acting as class constructors.
I'd suggest renaming
TransactionSigner
andMethodFactory
to something likeconstructTransactionSigner
andconstructMethodFactory
functions and then calling them without usingnew
but as a regular function calls.The text was updated successfully, but these errors were encountered: