web3 / web3.js

Collection of comprehensive TypeScript libraries for Interaction with the Ethereum JSON RPC API and utility functions.
https://web3js.org/
Other
19.38k stars 4.97k forks source link

TypeScript error in web3-eth-accounts/lib/commonjs/tx/transactionFactory.d.ts(8,81): ',' expected. TS1005 #6556

Closed slwhitman closed 10 months ago

slwhitman commented 1 year ago

Expected behavior

Program and npm library compiles without issue

Actual behavior

Compiler errors with TypeScript error in node_modules/web3-eth-accounts/lib/commonjs/tx/transactionFactory.d.ts(8,81): ',' expected. TS1005

See logs below....

Steps to reproduce the behavior

This error in not present on local build, only within the CircleCI build.

Note presence of artifact <unknown> in the compiled library transactionFactory.d.ts(8,81)

Logs

yarn run v1.22.19
$ react-scripts build
Creating an optimized production build...
Failed to compile.

/home/circleci/market/node_modules/web3-eth-accounts/lib/commonjs/tx/transactionFactory.d.ts
TypeScript error in /home/circleci/market/node_modules/web3-eth-accounts/lib/commonjs/tx/transactionFactory.d.ts(8,81):
',' expected.  TS1005

     6 |     private constructor();
     7 |     static typeToInt(txType: Numbers): number;
  >  8 |     static registerTransactionType<NewTxTypeClass extends typeof BaseTransaction<unknown>>(type: Numbers, txClass: NewTxTypeClass): void;
       |                                                                                 ^
     9 |     /**
    10 |      * Create a transaction from a `txData` object
    11 |      *

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Exited with code exit status 1

Environment

CircleCI Docker cimg/node:16.20.0 Node v16.20.0 npm v8.19.4 "typescript": "4.1.6" "web3": "1.3.0", "web3-eth-accounts": "^4.1.0" Windows 11OS

Muhammad-Altabba commented 1 year ago

Thanks for opening an issue @slwhitman, Could you please provide more info on how we can replicate this issue on our environment? Could you please share a simple repo that has this issue with the detailed steps?

And could you try with web3.js version 4?

Thanks,

slwhitman commented 1 year ago

Sure thing, check this repo https://github.com/slwhitman/web3Problem.git

Should be able to reproduce the problem with both web3@1.3.0 and web3@4.2.1

Windows 11, VS Code 1.83.1, Node 16.20.0, npm 8.16.4, yarn 1.22.19

See package.json for other core libs and environment

SwartZCoding commented 11 months ago

Hello ! I have the same issue. Did you fix it ? If yes, can you explain ? Thanks

Huzitatuguharu commented 11 months ago

Hi, I am having the same problem! I am having the same problem . If you have fixed it, could you please let me know? Thanks.

slwhitman commented 11 months ago

I eventually migrated to ethers.js. Couldn't fix this issue.

Huzitatuguharu commented 11 months ago

Thanks for the reply. I upgraded the TypeScript version and it resolved the issue. It may be similar to this problem. https://github.com/web3/web3.js/issues/6642

Muhammad-Altabba commented 10 months ago

So the issue was with Typescript compiler. I am closing this issue. However, if someone faced the same and could not resolve this issue by upgrading the Typescript version or fixing its configuration, please re-open the issue and provide more information to reproduce the exact issue on our machines or on a Cloud IDE. So, preferably share a github repository or, better, a link on a Cloud IDE like https://codesandbox.io/. Thanks,