Skip to content

type error: deployContract from utils.ts #208

@mayar-deeb-xi

Description

@mayar-deeb-xi

When I try to deploy a contract that has an Array in one of its constructor parameters,
I get the following error

Image Image

At src/utils.ts The type Array<BigNumberish> = [] dosn't match ContractFactory.deploy(...args: ContractMethodArgs<A>)
Image


There are two ways to solve this

Solution A

To use ContractMethodArgs<A> if u check ethersjs, you'll see ContractFactory class <A extends Array<any> = Array<any>
no type safety it'll just accept everything.

Solution B

Generic types, this is how it will look.

Image Image

If u did something wrong, like wrong (deployment params, function name, function params), you'll get this.

Image Image

Also, the function has a return type, it handles both cases, returns with names or without

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions