Skip to content

fix: network type was silently any instead of strict - #1608

Open
gomesalexandre wants to merge 1 commit into
scroll-tech:sepoliafrom
gomesalexandre:fix_network_type_any
Open

fix: network type was silently any instead of strict#1608
gomesalexandre wants to merge 1 commit into
scroll-tech:sepoliafrom
gomesalexandre:fix_network_type_any

Conversation

@gomesalexandre

Copy link
Copy Markdown

closes #964

what

Network (the type used across the app for network objects) was silently any, so every consumer lost type-safety on its fields - typos and wrong shapes compiled clean.

why

EmptyNetwork was declared as ValidNetwork<string, never>, but ValidNetwork is not generic. Because src/types/network.d.ts is covered by skipLibCheck, TypeScript never flagged the invalid instantiation and silently resolved EmptyNetwork to any. That collapsed the intersection Network = EmptyNetwork & ValidNetwork to any.

how

Declare EmptyNetwork as Partial<ValidNetwork> so the intersection resolves to a strict ValidNetwork and Network is a real type again. EmptyNetwork is only ever used inside the Network intersection, so the blast radius is limited to that.

verification

Ran the repo typechecker (tsc --noEmit) before/after:

  • before: const n: Network = 123 compiles (Network is any)
  • after: const n: Network = 123 errors TS2322 (number not assignable to ValidNetwork) - Network is strict again
  • zero new errors across the whole repo. The pre-existing TS2307: Cannot find module '@/assets/...' errors are unrelated - they come from running bare tsc without Next's webpack asset resolution, and are present identically before and after this change.

`EmptyNetwork` was declared as `ValidNetwork<string, never>`, but
`ValidNetwork` is not generic. Because `network.d.ts` is covered by
`skipLibCheck`, TypeScript never flagged the invalid instantiation and
silently resolved `EmptyNetwork` to `any`. That poisoned the whole type:
`Network = EmptyNetwork & ValidNetwork` collapsed to `any`, so every
consumer of `Network` lost all type-safety on network objects.

Declare `EmptyNetwork` as `Partial<ValidNetwork>` so the intersection
resolves to a strict `ValidNetwork` and `Network` is a real type again.

closes scroll-tech#964
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@gomesalexandre is attempting to deploy a commit to the Scroll Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Network type interpreted as ANY

1 participant