Skip to content

Name function type params and label dictionary keys in Flow libdefs - #2247

Merged
meta-codesync[bot] merged 1 commit into
mainfrom
export-D132693291
Nov 18, 2026
Merged

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

Conversation

@SamChou19815

Copy link
Copy Markdown
Member

Summary:
Names the parameters of function types, labels the keys of indexers and drops explicit exact object syntax ({| |}) in the Flow library definitions under React Native's flow-typed/ and packages/react-native/flow/, and in Metro's flow-typed/ (Metro's copies of environment/node.js and the babel, babel-types, debug and yargs npm libdefs get the same changes as React Native's). They keep type-checking once Flow requires these in library definitions as it already does in other files. Types are unchanged.

Changelog: [Internal]

Differential Revision: D132693291

Summary:
Names the parameters of function types, labels the keys of indexers and drops explicit exact object syntax (`{| |}`) in the Flow library definitions under React Native's `flow-typed/` and `packages/react-native/flow/`, and in Metro's `flow-typed/` (Metro's copies of `environment/node.js` and the `babel`, `babel-types`, `debug` and `yargs` npm libdefs get the same changes as React Native's). They keep type-checking once Flow requires these in library definitions as it already does in other files. Types are unchanged.

Changelog: [Internal]

Differential Revision: D132693291
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 17, 2026
@meta-codesync

meta-codesync Bot commented Nov 17, 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 D132693291.

@github-actions

Copy link
Copy Markdown

Metro review: Looks good

Risk: low · Commit: 2c82b07 · 5 commands run

This PR edits Flow libdefs only. It names function-type parameters, labels indexer keys, and swaps the explicit exact syntax {| |} for plain { }. The @babel/types generator script gets the same edits, so regenerating the libdef doesn't undo them. Metro's .flowconfig doesn't override exact_by_default, so it stays at its default (on) in Flow 0.340, and plain {} is exact. The types are therefore unchanged. Typecheck passes, and the generator reproduces the committed libdefs byte for byte.

No findings.

Verified
  • ✅ yarn typecheck (PR head) — Flow 0.340.0: No errors!
  • ✅ node -r @babel/register gen-check.js <head> (runs scripts/support/generateBabelFlowLibraryDefinitions.js and compares its output with the committed files) — Generated output matches the committed babel-types_v7.x.x.js and babel-traverse_v7.x.x.js exactly.
  • ✅ npx prettier --check <changed files>
  • ✅ yarn eslint scripts/support/generateBabelTypesFlowLibraryDefinition.js
  • ✅ grep .flowconfig for exact_by_default; npx flow version — No override is set, so the default (exact by default) applies in 0.340.0, and dropping {| |} leaves the types the same.

Not run: I ran no benchmarks, because the change is type-only and nothing changes at runtime. I didn't run Jest either, since no runtime code changed. Windows doesn't apply here.

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

@meta-codesync
meta-codesync Bot merged commit a21bdde into main Nov 18, 2026
18 of 19 checks passed
@SamChou19815
SamChou19815 deleted the export-D132693291 branch November 19, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported needs-meta-import

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants