Skip to content

Replace literal dictionary keys with properties or Record - #2337

Merged
meta-codesync[bot] merged 1 commit into
mainfrom
export-D136526662
Dec 6, 2026
Merged

meta-codesync[bot] merged 1 commit into
mainfrom
export-D136526662

Conversation

@SamChou19815

Copy link
Copy Markdown
Member

Summary:
Replaces Flow object indexers whose key types are literal unions (for example {[key: 'a' | 'b']: V}) with explicit properties or Record / Partial<Record> across React Native and Metro packages.

Dictionary indexers do not require literal union keys to be present and treat finite key sets as dynamic dictionaries; explicit properties and Record express these finite object shapes directly with no runtime changes.

Changelog: [Internal]

Differential Revision: D136526662

Summary:
Replaces Flow object indexers whose key types are literal unions (for example `{[key: 'a' | 'b']: V}`) with explicit properties or `Record` / `Partial<Record>` across React Native and Metro packages.

Dictionary indexers do not require literal union keys to be present and treat finite key sets as dynamic dictionaries; explicit properties and `Record` express these finite object shapes directly with no runtime changes.

Changelog: [Internal]

Differential Revision: D136526662
@meta-codesync

meta-codesync Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

@SamChou19815 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D136526662.

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

Metro review: Looks good

Risk: low · Commit: 61bae6f · 4 commands run

The PR changes two Flow types that used literal-union indexers to Record<...>: the BuiltInParsers declaration in flow-typed/prettier.js, and the WATCHERS map in the file-map watcher test helpers. Both objects always have every key, so Record describes them more precisely. The change is types-only and Flow full-check passes.

No findings.

Verified
  • ✅ yarn flow full-check (head) — Found 0 errors
  • ✅ yarn eslint flow-typed/prettier.js packages/metro-file-map/src/watchers/__tests__/helpers.js — No errors. One file is ignored by the lint config.
  • ❌ yarn jest --no-watchman packages/metro-file-map/src/watchers (head) — 11 failures, all in integration-test.js. This is the same result as base, so the failures come from sandbox file-watching limits and aren't caused by the PR.
  • ❌ yarn jest --no-watchman packages/metro-file-map/src/watchers (base) — Same 11 failures in integration-test.js as head.

Not run: No benchmarks were run because the change is types-only and has no runtime effect. The watcher integration tests can't fully run in the sandbox, which blocks file watching; they fail the same way on base and head.

Automated review by Claude. Advisory only: it never approves or blocks, and a maintainer makes the call.

@meta-codesync
meta-codesync Bot merged commit 0c8ee22 into main Dec 6, 2026
16 of 18 checks passed
@SamChou19815
SamChou19815 deleted the export-D136526662 branch December 6, 2026 18:51
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