fix(cli): add explicit viem client types - #882
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes TypeScript lint/build failures in the CLI examples caused by newer viem versions producing “unnamable” inferred client types, by adding explicit viem client return type annotations. It also updates pnpm’s trusted publishing policy exclusions to allow installs to succeed when langium@3.3.1 is pulled in via transitive dependencies.
Changes:
- Add explicit return types for
privateKeyClientandpublicClientinexamples/cli/src/client.tsusingWalletClient<HttpTransport, Chain, PrivateKeyAccount>andPublicClient<HttpTransport, Chain>. - Import
Chainfrom@filoz/synapse-core/chainsto preserve Synapse-specific chain extensions (e.g.,genesisTimestamp,filbeam) in typed downstream usage. - Add
langium@3.3.1totrustPolicyExcludeinpnpm-workspace.yamlto avoid pnpmno-downgradepolicy install failures.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pnpm-workspace.yaml | Adds langium@3.3.1 to trustPolicyExclude to keep pnpm install working under trustPolicy: no-downgrade. |
| examples/cli/src/client.ts | Adds explicit viem client type annotations to avoid TS2883 errors with newer viem type exports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hugomrdias
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
CI lint fails on #857 (and every PR since ~Jul 10) with 17x TS2883 in
examples/cli/src/client.ts. viem 2.54.x added token actions (actions/token/approve,getAllowance, etc.), and since pnpm-lock.yaml is gitignored, CI resolves the newest viem allowed byminimumReleaseAgeregardless of the^2.52.0catalog entry. With 2.54.x, tsc can no longer name the inferred return types ofprivateKeyClient/publicClientwithout reaching intoviem/_types/actions/token/*. This adds explicit return type annotations (WalletClient<HttpTransport, Chain, PrivateKeyAccount>/PublicClient<HttpTransport, Chain>, withChainfrom synapse-core so downstream commands keepgenesisTimestamp/filbeam).Also adds
langium@3.3.1totrustPolicyExclude. langium adopted trusted publishing at 4.x; 3.3.1 (Jan 2025) predates it, so theno-downgradepolicy now rejects it andpnpm installfails with pnpm 11.5.3 (the pinned packageManager version). It's exact-pinned by@mermaid-js/parservia mermaid in docs.. same situation as the existing chokidar@4.0.3 exclusion.How to verify
Reproduced locally by re-resolving without a lockfile, which pulled viem 2.54.6 and produced the same 17 errors as the failing job. With this branch,
pnpm run lint,pnpm run build, andpnpm testall pass on viem 2.54.6.