AddressType - definition as 0x{string}
-- is this better than string
?
#49
Replies: 2 comments 5 replies
-
I'd like to think so. That way you don't accidentally pass in a non-address value. It also makes types more obvious if you use ABIType in functions for autocomplete, etc. That said, you can configure ABIType to use whatever declare module 'abitype' {
export interface Config {
AddressType: string
}
} |
Beta Was this translation helpful? Give feedback.
-
The idea of checking if an Address starts with a 0x is great in theory, but in practice, it makes too many problems:
Which then renders the whole type-checking meaningless. Also, most errors with addresses are based on a wrong address-chain connection and can only be found at runtime. So, this library works great, but this one opinionated configuration could imho be changed. <3 |
Beta Was this translation helpful? Give feedback.
-
I'm curious on the thinking behind defining AddressType as
0x{string}
? It feels overly restrictive for very little increase in type safety. I guess I can't really come up with a big negative except now I need to go change all myaddress: string
types 😭Beta Was this translation helpful? Give feedback.
All reactions