Repository navigation
AddressType - definition as 0x{string} -- is this better than string?
#49
Closed
appleseed-iii
started this conversation in
General
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
}
} |
3 replies
|
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 |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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: stringtypes 😭All reactions