You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Installing @safe-global/api-kit changes the global type definition for Ethereum addresses from 0x${string} to string through a module augmentation of abitype:
// In @safe-global/api-kit/dist/index.d.tsdeclare module 'abitype'{interfaceRegister{AddressType: string;}}
This global change affects all packages that depend on abitype for their types (including viem and by extension wagmi), weakening type safety across the entire consuming application.
Impact
Changes viem's Address type from 0x${string} to string project-wide
Affects type safety in consuming applications that rely on strict address typing
Makes it harder to catch malformed addresses at compile time
Prevents applications from maintaining stricter address types even in their own code
Attempted Solutions
Creating a local module augmentation to restore the stricter type results in TypeScript resolving the type to any
No way to "opt out" of the global type modification
First import Address from viem alone and inspect the type
Import API Kit before viem and inspect type again
Expected result
Installing @safe-global/api-kit should not affect the type definitions of other packages. The Address type from viem should remain 0x${string} regardless of whether Safe API Kit is installed or not.
The text was updated successfully, but these errors were encountered:
pheuberger
added a commit
to pheuberger/hypercerts-app
that referenced
this issue
Dec 24, 2024
This patch adds API Kit which unfortunately overrides viem's Address
type and thus introduces build errors around code that was and still is
fine. Please read this GitHub issue for more details:
safe-global/safe-core-sdk#1087
To get the app to build again I needed to assert address to be of type
`0x${string}` in a few places. We know it's the correct type, it's just
that the TypeScript compiler doesn't, so this is safe to do.
pheuberger
added a commit
to pheuberger/hypercerts-app
that referenced
this issue
Dec 24, 2024
This patch adds API Kit which unfortunately overrides viem's Address
type and thus introduces build errors around code that was and still is
fine. Please read this GitHub issue for more details:
safe-global/safe-core-sdk#1087
To get the app to build again I needed to assert address to be of type
`0x${string}` in a few places. We know it's the correct type, it's just
that the TypeScript compiler doesn't, so this is safe to do.
Description
Installing
@safe-global/api-kit
changes the global type definition for Ethereum addresses from0x${string}
tostring
through a module augmentation ofabitype
:This global change affects all packages that depend on
abitype
for their types (includingviem
and by extensionwagmi
), weakening type safety across the entire consuming application.Impact
viem
'sAddress
type from0x${string}
tostring
project-wideAttempted Solutions
any
Environment
Steps to reproduce
viem
alone and inspect the typeviem
and inspect type againExpected result
Installing
@safe-global/api-kit
should not affect the type definitions of other packages. TheAddress
type from viem should remain0x${string}
regardless of whether Safe API Kit is installed or not.The text was updated successfully, but these errors were encountered: