diff --git a/types/web3/index.d.ts b/types/web3/index.d.ts index 3b1fe0c562..0f80294f1a 100644 --- a/types/web3/index.d.ts +++ b/types/web3/index.d.ts @@ -19,6 +19,7 @@ // Donam Kim // Doug Kent // Daniel Zhou +// Alex Kvak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 diff --git a/types/web3/utils.d.ts b/types/web3/utils.d.ts index c9dc3c863d..055a306dd9 100644 --- a/types/web3/utils.d.ts +++ b/types/web3/utils.d.ts @@ -88,7 +88,7 @@ export default interface Utils { toDecimal(val: any): number; toHex(val: any): string; toUtf8(val: any): string; - toWei(val: string | number, unit?: Unit): string; + toWei(val: string, unit?: Unit): string; toWei(val: BigNumber, unit?: Unit): BigNumber; unitMap: any; } diff --git a/types/web3/web3-tests.ts b/types/web3/web3-tests.ts index e13c0a9254..de314a2f82 100644 --- a/types/web3/web3-tests.ts +++ b/types/web3/web3-tests.ts @@ -163,6 +163,9 @@ const shhPromise: Promise = web3.shh.generateSymKeyFromPassword("xyz"); // -------------------------------------------------------------------------- const weiStr: string = web3.utils.toWei("100", "gwei"); const weiBn: BigNumber = web3.utils.toWei(web3.utils.toBN("1")); +// $ExpectError +const weiNumber = web3.utils.toWei(100); + const rndHex: string = Web3.utils.randomHex(10); const sha3: string = web3.utils.soliditySha3(0, 1, "abc"); const fromWei1: string = web3.utils.fromWei(new BigNumber(1));