Skip to content

Should AddressType be string by default? #226

Closed Answered by tmm
valle-xyz asked this question in Q&A
Discussion options

You must be logged in to vote

At the moment, we still prefer it to be opt out instead of opt in. It's not that difficult to opt out — only 5 lines of code.

declare module 'abitype' {
  export interface Register {
    AddressType: string
  }
}

It does not recognize correct addresses that are imported from json

Importing JSON files is an anti-pattern for strict TypeScript. If you are using plain JS, you can still do better by using a narrow(value) function.

Scrolling through the viem Discord, it seems like many people are casting their types manually.

I wouldn't consider this a representative example.

The check does not add value, as a correctly formatted address could still be incorrect for the given usecase.

Str…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@valle-xyz
Comment options

Answer selected by tmm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants