Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Eth is not a constructor #3198

@slavafomin

Description

@slavafomin

Hello!

According to the typings, the web3-eth package exports the Eth class.

Here's the usage code which is 100% correct according to the provided typings:

import { Eth } from 'web3-eth';

const eth = new Eth(provider);

However, at runtime it causes the Eth is not a constructor error.

I have to use this typing augmentation:

import { Eth } from 'web3-eth';

declare module 'web3-eth' {
  export = Eth;
}

And to import it like this: import Eth from 'web3-eth'; in order to make it work.

You need to replace export class Eth { ... } with export = class Eth { ... } in your declarations.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.x1.0 related issuesStaleHas not received enough activityTypesIncorrect or missing types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions