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.

Improve typings for contracts

See original GitHub issue

Hey Richard!

I am the maintainer of TypeChain and I would like to forward some ideas that would greatly improve our generated types. I am more than happy to make PRs to fix this - I just want to discuss these ideas first here.

  1. TypeChain generated contracts extend packages/contracts/src.ts/index.ts/Contract class. The problem is that this class has index signatures for functions which we can’t override in any way.

Example: readonly functions: { [ name: string ]: ContractFunction };

Despite the fact that we generate exact typings for all contract methods it’s possible to mistype a method name and use a generic ContractFunction. This should result in a type error. I would propose extracting BaseContract interface without any index signatures so both ethers’s Contract and TypeChain generated types can extend that.

Related to: https://github.com/ethereum-ts/TypeChain/issues/276 and https://github.com/ethereum-ts/TypeChain/issues/351

  1. We realized that packages/contracts/src.ts/index.ts/Overrides is missing { from?: string | Promise<string> }. I would like to add it.

Related to: https://github.com/ethereum-ts/TypeChain/pull/345

WDYT? As I mentioned already I can prepare PR if you approve these changes.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
ricmoocommented, Mar 30, 2021

This is now in 5.1.0. Try it out and let me know how it goes. 😃

1reaction
krzkaczorcommented, May 31, 2021

@ricmoo closing this now. The problem that I described above was caused by ethers version mismatch. Thanks! Ethers & TypeChain work great together now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improve Your Typing Speed - Translation Excellence
Is your typing slowing you down? Do you wish you could type faster? Read this week's tip-of-the-week to learn how to improve your...
Read more >
Learn To Type And Improve Typing Speed Free - Typing.com
Learn to touch type and improve your typing speed with free interactive typing lessons for all ages. Start your typing practice now!
Read more >
Improving Your Typing Speed Can Get You These Jobs - Typesy
Many entry-level jobs require touch typing skills, so improving your touch typing won't hurt your career, no matter what field you want to ......
Read more >
Legal Typing Practice - Peter's Online Typing Course
Find out your typing speed (WPM) at the end and how many errors you made. Choose a category: Famous Law Quotes · Legal...
Read more >
4 Tips for Improving Your Typing Speed and Accuracy
Interested in improving your typing speed and accuracy? These 4 tips will help you in learning to type faster and with more accuracy...
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