Update undici dependency#948
Conversation
|
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
There was a problem hiding this comment.
LGTM with some comments:
I'm not convinced about the as <Type> casts. Following these recommendations, we should create functions for checking types, for example:
function isEtherscanResponseBody(input: any): json is EtherscanResponseBody {
return 'status' in input;
} However, I also don't think we should accumulate these type-checking functions all over the place. The current state is good to me but mentioning in case you agree with "better" type-checking @ericglau
|
@ernestognw Agree it would be good to improve type checking, but perhaps that can be left until/unless there are changes in Etherscan's API or issues with the current approach. I don't a large benefit in adding checking at the moment, other than to give a better error message, but if errors occur then the issue might be quite apparent. Note that Hardhat currently does a cast as well. |
response.body.json();previously returned any, but now returns unknown in newer version of undici. We should cast it to the expected type.