Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Broken TypeScript typings on fresh install #2855

Closed
1 task done
kdembler opened this issue Feb 26, 2020 · 3 comments · Fixed by #2858
Closed
1 task done

Broken TypeScript typings on fresh install #2855

kdembler opened this issue Feb 26, 2020 · 3 comments · Fixed by #2858

Comments

@kdembler
Copy link


Issue

After a fresh install of @truffle/hdwallet-provider (other packages possibly affected as well) TypeScript typings are not working correctly and compilation fails.

Mentioned in trufflesuite/ganache#465 but it's a different repo and didn't gain much traction

Steps to Reproduce

  1. npm install @truffle/hdwallet-provider web3
  2. Put inside src/index.ts:
import HDWalletProvider from "@truffle/hdwallet-provider";
console.log("Hello world!")
  1. npx typescript --esModuleInterop src/index.ts

Expected Behavior

Compilation succeeds without any issues.

Actual Results

Typecheck fails with the following errors:

node_modules/@truffle/hdwallet-provider/dist/index.d.ts:2:61 - error TS2307: Cannot find module 'ethereum-protocol'.
import { JSONRPCRequestPayload, JSONRPCErrorCallback } from "ethereum-protocol";
                                                             ~~~~~~~~~~~~~~~~~~~
node_modules/@truffle/hdwallet-provider/dist/index.d.ts:3:43 - error TS2307: Cannot find module 'web3/providers'.
import { Callback, JsonRPCResponse } from "web3/providers";
                                           ~~~~~~~~~~~~~~~~

Environment

  • Operating System: Tested on macOS and Arch Linux
  • node version (node --version): Tested on v10.18.0 and v13.9.0
  • npm version (npm --version): 6.13.4, 6.13.7
@CruzMolina
Copy link
Contributor

CruzMolina commented Feb 26, 2020

Ah, looks like we're missing those two pkgs as devDeps (ethereum-protocol, @types/web3)

Cool, looks like it was just @types/web3.

@forshtat
Copy link

forshtat commented Apr 29, 2020

@CruzMolina I am not sure the PR solves the problem, as the latest '@types/web3' does not include any types and instead says, quote, "web3 provides its own type definitions, so you don't need @types/web3 installed!"
But then there seems to be no "web3/providers" in the original web3 package.

@Butterneck
Copy link

@CruzMolina I am not sure the PR solves the problem, as the latest '@types/web3' does not include any types and instead says, quote, "web3 provides its own type definitions, so you don't need @types/web3 installed!"
But then there seems to be no "web3/providers" in the original web3 package.

Did you find a solution? I'm having the same issue #3777

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants