question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

generated typescript typing broken: must be unknown first

See original GitHub issue

When building the generated typescript, I get this error:

TS2352: Conversion of type 'Contract' to type 'AccountLoader' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

Generated code:

/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */

import { Contract, Signer } from "ethers";
import { Provider } from "@ethersproject/providers";

import type { AccountLoader } from "../AccountLoader";

export class AccountLoader__factory {
  static connect(
    address: string,
    signerOrProvider: Signer | Provider
  ): AccountLoader {
    return new Contract(address, _abi, signerOrProvider) as AccountLoader;
  }
}

const _abi = <omitted for concision>

node version v12.19.0 ts-node version v9.0.0 yarn version 1.22.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
quezakcommented, Feb 27, 2021

@robert-e-davidson3 most likely the code is correct but there were some incompatible changes in ethers. Can you update all ethers packages and try again? See also a similar issue in #328

1reaction
robert-e-davidson3commented, Mar 15, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

generated typescript typing broken: must be unknown first #330
When building the generated typescript, I get this error: TS2352: Conversion of type 'Contract' to type 'AccountLoader' may be a mistake ...
Read more >
Object is of type 'unknown' typescript generics - Stack Overflow
I got this error in the catch block. After debugging for a while I came to know that starting typescript v4.0, catch clause...
Read more >
TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >
Documentation - Template Literal Types - TypeScript
Generating mapping types which change properties via template literal strings.
Read more >
Documentation - TypeScript 4.8
For example, unknown is close in spirit to the union type {} | null | undefined because it accepts null , undefined ,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found