Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support strict function types #8

Open
macalinao opened this issue Nov 29, 2020 · 0 comments
Open

Support strict function types #8

macalinao opened this issue Nov 29, 2020 · 0 comments

Comments

@macalinao
Copy link

Using tsconfig strict gives an error with the Provider type. I had to implement the following to silence the error:

diff --git a/node_modules/@compound-finance/compound-js/dist/nodejs/types/index.d.ts b/node_modules/@compound-finance/compound-js/dist/nodejs/types/index.d.ts
index 9fa7d65..6fa7580 100644
--- a/node_modules/@compound-finance/compound-js/dist/nodejs/types/index.d.ts
+++ b/node_modules/@compound-finance/compound-js/dist/nodejs/types/index.d.ts
@@ -71,15 +71,13 @@ export interface ProviderNetwork {
     id?: number;
     name?: string;
 }
-declare type GenericGetBalance = (addressOrName: string | number | Promise<string | number>, blockTag?: string | number | Promise<string | number>) => Promise<BigNumber>;
-declare type GenericGetTransactionCount = (addressOrName: string | number | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>) => Promise<number>;
 declare type GenericSendTransaction = (transaction: string | Promise<string> | Deferrable<TransactionRequest>) => Promise<TransactionResponse>;
 export interface Provider extends AbstractSigner, FallbackProvider {
     connection?: Connection;
     _network: Network;
     call: AbstractSigner['call'] | FallbackProvider['call'];
-    getBalance: GenericGetBalance;
-    getTransactionCount: GenericGetTransactionCount;
+    getBalance: any;
+    getTransactionCount: any;
     resolveName: AbstractSigner['resolveName'] | FallbackProvider['resolveName'];
     sendTransaction: GenericSendTransaction;
     send?: (method: string, parameters: string[]) => any;

The solution is to treat Providers and Signers differently in the code, probably from some sort of disjoint union type. Unfortunately this may require some refactoring.

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

No branches or pull requests

1 participant