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

Typescript errors in 2.0.4 eg Not all code paths return a value #2260

Closed
payprmoney opened this issue Jan 14, 2022 · 7 comments
Closed

Typescript errors in 2.0.4 eg Not all code paths return a value #2260

payprmoney opened this issue Jan 14, 2022 · 7 comments
Assignees

Comments

@payprmoney
Copy link

When I bump from version 2.0.3 to 2.0.4, I get new typescript compilation errors I didn't see before:

node_modules/hardhat/src/internal/hardhat-network/stack-traces/model.ts:278:55 - error TS7030: Not all code paths return a value.

278   public static fromABI(name: string, inputs: any[]): CustomError | undefined {
                                                          ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/hardhat/src/types/config.ts:273:11 - error TS2503: Cannot find namespace 'Mocha'.

273   mocha?: Mocha.MochaOptions;
              ~~~~~

node_modules/hardhat/src/types/config.ts:281:10 - error TS2503: Cannot find namespace 'Mocha'.

281   mocha: Mocha.MochaOptions;
             ~~~~~


Found 3 errors.

I have confirmed that everything works great when moving back to 2.0.3

@fvictorio
Copy link
Member

Hi @payprmoney, thanks for reporting this. You are upgrading to version 2.0.4 of what? Hardhat? Or some plugin?

Also, is your repo public, or there's some way I can reproduce this?

@fvictorio fvictorio added the status:needs-more-info There's not enough information to start working on this issue label Jan 17, 2022
@payprmoney
Copy link
Author

The specific library we are updating is @nomiclabs/hardhat-ethers from 2.0.3 to 2.0.4.

The repo is ethereum-contracts and this is a PR that is failing.

@fvictorio
Copy link
Member

Thank you! I'll take a look.

@fvictorio fvictorio removed the status:needs-more-info There's not enough information to start working on this issue label Jan 17, 2022
@fvictorio
Copy link
Member

Hey @payprmoney, thanks a lot for reporting this. Definitely a bug on our side. We'll fix this and release a new version soon.

The underlying problem is that, when you run tsc, the Harhdat source is being compiled, and it's not compatible with your config. For the time being, there is a (lame) workaround you can do:

  • Install @types/mocha
  • Change your tsconfig.json to have noImplicitReturns: false

This assumes that you need the new methods added in hardhat-ethers v2.0.4. If not, then downgrading is perfectly fine.

@clemsos
Copy link

clemsos commented Jan 27, 2022

thanks @fvictorio . getting the same error here with 2.0.4, the fix works

Also this

node_modules/hardhat/src/types/runtime.ts:9:30 - error TS6133: 'T' is declared but its value is never read.

9 export interface ArgumentType<T> {

@fvictorio
Copy link
Member

Yes, we fixed this but haven't released it yet. We'll do it early next week.

@alcuadrado
Copy link
Member

This has already been released.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants