Skip to content

fix(cli): add explicit viem client types - #882

Merged
hugomrdias merged 2 commits into
masterfrom
fix/examples-cli-viem-portable-types
Jul 15, 2026
Merged

fix(cli): add explicit viem client types#882
hugomrdias merged 2 commits into
masterfrom
fix/examples-cli-viem-portable-types

Conversation

@SgtPooki

Copy link
Copy Markdown
Contributor

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 by minimumReleaseAge regardless of the ^2.52.0 catalog entry. With 2.54.x, tsc can no longer name the inferred return types of privateKeyClient/publicClient without reaching into viem/_types/actions/token/*. This adds explicit return type annotations (WalletClient<HttpTransport, Chain, PrivateKeyAccount> / PublicClient<HttpTransport, Chain>, with Chain from synapse-core so downstream commands keep genesisTimestamp/filbeam).

Also adds langium@3.3.1 to trustPolicyExclude. langium adopted trusted publishing at 4.x; 3.3.1 (Jan 2025) predates it, so the no-downgrade policy now rejects it and pnpm install fails with pnpm 11.5.3 (the pinned packageManager version). It's exact-pinned by @mermaid-js/parser via 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, and pnpm test all pass on viem 2.54.6.

@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Jul 15, 2026
@SgtPooki SgtPooki moved this from 📌 Triage to 🔎 Awaiting review in FOC Jul 15, 2026
@SgtPooki SgtPooki self-assigned this Jul 15, 2026
@BigLep
BigLep requested a review from Copilot July 15, 2026 16:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 privateKeyClient and publicClient in examples/cli/src/client.ts using WalletClient<HttpTransport, Chain, PrivateKeyAccount> and PublicClient<HttpTransport, Chain>.
  • Import Chain from @filoz/synapse-core/chains to preserve Synapse-specific chain extensions (e.g., genesisTimestamp, filbeam) in typed downstream usage.
  • Add langium@3.3.1 to trustPolicyExclude in pnpm-workspace.yaml to avoid pnpm no-downgrade policy 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.

@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FOC Jul 15, 2026
@hugomrdias
hugomrdias merged commit 873e503 into master Jul 15, 2026
15 checks passed
@hugomrdias
hugomrdias deleted the fix/examples-cli-viem-portable-types branch July 15, 2026 16:51
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

3 participants