Ethers.js: Is there any plans for @ethersproject/units to support TS 4.1.x

Created on 10 Feb 2021  Â·  9Comments  Â·  Source: ethers-io/ethers.js

We're currently trying to use @ethersproject/units (5.0.10) inside a react project which is built using a new version of TS:

"typescript": "^4.1.3",

currently, when trying to compile, we get the following type error from tsc:

node_modules/@ethersproject/experimental/lib/nonce-manager.d.ts:7:9 - error TS2611: 'provider' is defined as a property in class 'Signer', but is overridden here in 'NonceManager' as an accessor.

7     get provider(): ethers.providers.Provider;
          ~~~~~~~~

Found 1 error.

I've noticed that typescript 3.x is listed as a dev dependency for this repo:

"typescript": "3.8.3",

Just wondering if anyone else slammed into this?
If not, are there any plans to support newer TS installations?

enhancement fixed

Most helpful comment

I’m working on v6 right now which uses the latest greatest TS.

I don’t mind bumping the version up for v5 too though. I just need to communicate it because TS does make changes like this that can break people...

I’m surprised I haven’t ran into the above problem myself...

All 9 comments

I’m working on v6 right now which uses the latest greatest TS.

I don’t mind bumping the version up for v5 too though. I just need to communicate it because TS does make changes like this that can break people...

I’m surprised I haven’t ran into the above problem myself...

I'm running into this problem right now with typescript 4.1.5

I have put up a tweet seeking community feedback. If I haven't heard any compelling reasons by next week, I will bump the version and re-publish.

Any feedback is welcome!

Thanks! :)

Hi, are you thinking of a specific date for bumping to typescript 4.2.2?

Probably this weekend. I’ve given notice on Twitter and been using 4.2.2 for a week or so to make sure there are obvious no hiccups… I am currently using it in my local v6 branch and things seem fairly compatible. :)

Can you try out 5.0.32 and let me know how it works for you? It is using TypeScript 4.2.2.

I bumped both "ethers": "^5.0.32" and "typescript": "^4.2.2".

When I run npx tsc -p tsconfig.json I still get this errors:

node_modules/@ethersproject/providers/src.ts/base-provider.ts:1387:32 - error TS2322: Type 'null' is not assignable to type 'Resolver'.
...
node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:279:13 - error TS2322: Type 'Networkish | undefined' is not assignable to type 'Networkish | Promise<Network>'.

Ideas?

Sounds like you have strict null checking enabled on libraries? V5 doesn’t support strict bull checking. There is an option on the tsconfig to disable checking libraries for strict...

I updated these 2 parameters in my tsconfig.json and it works fine now:

    "strict": false,
    "noImplicitAny": false,

Thanks @ricmoo!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dagogodboss picture dagogodboss  Â·  3Comments

jochenonline picture jochenonline  Â·  3Comments

GFJHogue picture GFJHogue  Â·  3Comments

jochenonline picture jochenonline  Â·  3Comments

abhishekp1996 picture abhishekp1996  Â·  3Comments