Hi all,
As I know, utility functions are also exposed on the Web3 class as well as on instance of Web3. But I've found Utils only in an instance.
import Web3 = require('web3');
const randomHex = Web3.utils.randomHex(10);
Typescript won't compile because Web3 does not have a key utils.
Typescript should compile because Web3 has a key utils.
@types/web3 package and had problems.Definitions by: in index.d.ts) so they can respond.Gonna look into this over the weekend.
Typically web3. Why on earth should these utils be at two places?
Back to the topic at hand: Should be fixed. Will you provide a PR @archangel-irk ?
@Levino Yes, I'm going to make the PR.
Please review #27898. This should fix the problem.
To clarify:
import Web3 = require('web3')
const randomHex = Web3.utils.randomHex(10)
Please note: Web3 not web3
Typescript won't compile because Web3 does not have a key utils.
Typescript should compile because Web3 has a key utils.
@archangel-irk Maybe you want to update your issue based on my clarification above.
@Levino updated
I'm going to make a PR today.
Updated:
Please review PR #27963
So in according to recent changes we have two identical PR's #27898 and #27963
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/27898 should be closed not merged, it contains a footgun. See also https://github.com/DefinitelyTyped/DefinitelyTyped/pull/27898#issuecomment-411366737
Most helpful comment
Gonna look into this over the weekend.