Content
@
0 reply
0 recast
0 reaction
Darryl Yeo 🛠️
@darrylyeo
viem’s extreme type safety is awesome if you know the exact shape of all your parameters the moment you call each client action. As soon as you want to derive your own composable helper functions with partial or variable parameters… the TypeScript generics get complicated, fast. 😅
3 replies
2 recasts
9 reactions
greg
@gregfromstl
Yep this is a huge problem with web3 libraries in general that we’ve been thinking about @thirdweb. Would you rather have more flexible, basic types that you can build on top of to increase strictness?
2 replies
0 recast
2 reactions
Darryl Yeo 🛠️
@darrylyeo
The biggest thing for me is that no matter how many `Param extends X ? A : B` conditionals there are under the hood, there should always be a weaker “umbrella type” that subsumes all possible type params (including any used in nested fields) without REQUIRING me to manually cast values with `as` or redefine and forward the type params myself. Not trivial when there are interdependent type params across functions, I realize. But a loose umbrella type would provide an escape hatch where I can choose to make strict typing opt-in. I don’t always have time to go down rabbit holes in my library’s source code to chase down what stuff between `<` and `>` I need to copy/paste to my helper function and in what order. 😅
1 reply
0 recast
1 reaction
Vladyslav Dalechyn
@dalechyn.eth
I think this will come with a cost of losing strict typing, or might be unnecessary. Can you give an example of the dilemma?
1 reply
0 recast
1 reaction