Skip to content

fix: pin @types/node to deduplicate Vite type resolutions#3650

Merged
itsjustriley merged 1 commit intomainfrom
fix/dedupe-types-node
Apr 1, 2026
Merged

fix: pin @types/node to deduplicate Vite type resolutions#3650
itsjustriley merged 1 commit intomainfrom
fix/dedupe-types-node

Conversation

@itsjustriley
Copy link
Copy Markdown
Contributor

@itsjustriley itsjustriley commented Apr 1, 2026

WHY are these changes introduced?

The happy-dom bump (#3638) introduced a dependency graph change that caused pnpm to resolve @types/node to two different patch versions (22.19.11 and 22.19.15) across workspace packages. The split wasn't caught because #3638's CI was cancelled, and subsequent PRs (including #3572) inherited the broken state. This broke CI on main:

TypeScript failure: Vite's Plugin<any> type from one @types/node resolution is not assignable to Plugin<any> from the other, causing TS2769: No overload matches this call in the skeleton's vite.config.ts.

Unit test failure: The duplicate resolution caused mismatched vitest peer dependency trees, breaking snapshot infrastructure in hydrogen-react (Image.test.tsx, RichText.test.tsx, getProductOptions.test.ts).

Root cause: The workspace catalog specified @types/node: ^22 (a range). The existing override (@types/node: catalog:) correctly funnels all resolutions through the catalog, but pnpm's partial lockfile resolution resolves the range to different patch versions for new vs existing entries. Pinning to an exact version completes the design intent of the override.

WHAT is this pull request doing?

Pins @types/node to 22.19.15 in the workspace catalog so pnpm produces a single resolution across all packages.

HOW to test your changes?

  1. pnpm run typecheck — should pass with zero errors
  2. cd packages/hydrogen-react && npx vitest run — 412 tests pass (the previously failing snapshot tests are green)
  3. cd packages/hydrogen && npx vitest run — 500 tests pass

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

pnpm resolved @types/node to two different patch versions (22.19.11 and
22.19.15) across workspace packages. This caused Vite's Plugin<any> type
from one resolution to be incompatible with Plugin<any> from the other,
breaking the skeleton template's typecheck with TS2769.

The duplicate resolution also caused snapshot infrastructure failures in
hydrogen-react unit tests (Image.test.tsx, RichText.test.tsx,
getProductOptions.test.ts) due to mismatched vitest peer dependency trees.

Pin @types/node to 22.19.15 in the catalog so pnpm produces a single
resolution across all workspace packages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shopify
Copy link
Copy Markdown
Contributor

shopify bot commented Apr 1, 2026

Oxygen deployed a preview of your fix/dedupe-types-node branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment April 1, 2026 1:25 PM

Learn more about Hydrogen's GitHub integration.

@itsjustriley itsjustriley marked this pull request as ready for review April 1, 2026 13:37
@itsjustriley itsjustriley requested a review from a team as a code owner April 1, 2026 13:37
@itsjustriley itsjustriley changed the title Fix duplicate @types/node resolution breaking TypeScript and unit tests fix: pin @types/node to deduplicate Vite type resolutions Apr 1, 2026
Copy link
Copy Markdown
Contributor

@fredericoo fredericoo left a comment

Choose a reason for hiding this comment

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

i think it was dependabot not being aware of monorepo and surgically updating the lockfile instead of actually running the install

I dont think we needed to pin it, but just to reinstall packages

BUT it also doesn’t hurt it (we already update manually) so lets go

thanks for fixing this! we should note it for future dependabot updates

@itsjustriley itsjustriley merged commit 351d55d into main Apr 1, 2026
19 of 20 checks passed
@itsjustriley itsjustriley deleted the fix/dedupe-types-node branch April 1, 2026 14:33
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.

2 participants