generated typescript typing broken: must be unknown first
See original GitHub issueWhen 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:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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
You linked this issue. PR: https://github.com/ethereum-ts/TypeChain/pull/347