Skip to content

Add DOM.Iterable to hydrogen-react tsconfig lib#3766

Open
LeSingh1 wants to merge 1 commit into
Shopify:mainfrom
LeSingh1:fix/hydrogen-react-dom-iterable-lib
Open

Add DOM.Iterable to hydrogen-react tsconfig lib#3766
LeSingh1 wants to merge 1 commit into
Shopify:mainfrom
LeSingh1:fix/hydrogen-react-dom-iterable-lib

Conversation

@LeSingh1
Copy link
Copy Markdown

WHY are these changes introduced?

The packages/hydrogen-react/tsconfig.json lib setting was ["DOM", "ESNext"], which is missing DOM.Iterable. Without it, the type definitions for URLSearchParams, FormData, Headers, NodeList, and similar DOM iterables do not expose their [Symbol.iterator] method, so iterating them (or spreading them into Object.fromEntries) does not type-check.

This forced a workaround in useSelectedOptionInUrlParam.tsx: two @ts-ignore directives plus matching eslint-disable comments, alongside an outdated TODO: update ts lib. The root tsconfig.json at the monorepo root already sets lib: ["DOM", "DOM.Iterable", "ESNext"], so this brings the package into line with the rest of the workspace.

WHAT is this pull request doing?

  • Adds DOM.Iterable to the lib array in packages/hydrogen-react/tsconfig.json.
  • Removes the @ts-ignore / eslint-disable workaround and the stale TODO comment in useSelectedOptionInUrlParam.tsx. The runtime behaviour is unchanged.
  • Adds a patch changeset.

HOW to test your changes?

From the repo root after pnpm install:

cd packages/hydrogen-react
pnpm run typecheck:code

tsc --noEmit passes with the workaround removed.

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 functional changes. Test changes or internal-only config changes do not require a changeset.
  • I've added tests to cover my changes
  • I've added or updated the documentation

@LeSingh1 LeSingh1 requested a review from a team as a code owner May 19, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant