Problem
@safe-global/types-kit exports a global declare module 'abitype' that overrides AddressType to string:
https://github.com/safe-global/safe-core-sdk/blob/main/packages/types-kit/src/index.ts#L15-L24
declare module 'abitype' {
export interface Register {
AddressType: string
}
}
This is a global ambient declaration — any project that depends on @safe-global/types-kit (even transitively via api-kit or protocol-kit) has its abitype Address type silently widened from `0x${string}` to string.
Impact
- All viem/wagmi types are affected.
useAccount().address becomes string | undefined instead of `0x${string}` | undefined, breaking type-safety for any project that uses both wagmi and Safe SDK.
- The consumer has no way to opt out short of adding their own counter-declaration in every TypeScript compilation unit:
declare module 'abitype' {
interface Register {
AddressType: `0x${string}`;
}
}
- This affects any monorepo or app that pulls in
@safe-global/api-kit or @safe-global/protocol-kit as a dependency, even if the Safe SDK is only used in a small part of the codebase.
Suggestion
Move the declare module 'abitype' block out of the published package's type declarations. If Safe SDK needs AddressType: string internally (e.g. for ethers.js compatibility), it should be scoped to the SDK's own compilation — not exported to consumers.
Options:
- Move it to a
tsconfig or internal .d.ts file that is not included in the published dist/
- Use type assertions (
as string) at the Safe SDK boundary instead of globally overriding abitype's Register
Environment
@safe-global/types-kit: 3.0.0
abitype: 1.2.3
viem: 2.44.4
wagmi: 2.19.5
typescript: 5.9.3
Problem
@safe-global/types-kitexports a globaldeclare module 'abitype'that overridesAddressTypetostring:https://github.com/safe-global/safe-core-sdk/blob/main/packages/types-kit/src/index.ts#L15-L24
This is a global ambient declaration — any project that depends on
@safe-global/types-kit(even transitively viaapi-kitorprotocol-kit) has its abitypeAddresstype silently widened from`0x${string}`tostring.Impact
useAccount().addressbecomesstring | undefinedinstead of`0x${string}` | undefined, breaking type-safety for any project that uses both wagmi and Safe SDK.@safe-global/api-kitor@safe-global/protocol-kitas a dependency, even if the Safe SDK is only used in a small part of the codebase.Suggestion
Move the
declare module 'abitype'block out of the published package's type declarations. If Safe SDK needsAddressType: stringinternally (e.g. for ethers.js compatibility), it should be scoped to the SDK's own compilation — not exported to consumers.Options:
tsconfigor internal.d.tsfile that is not included in the publisheddist/as string) at the Safe SDK boundary instead of globally overriding abitype's RegisterEnvironment
@safe-global/types-kit: 3.0.0abitype: 1.2.3viem: 2.44.4wagmi: 2.19.5typescript: 5.9.3