Skip to content

Type Babel's definition constants and numeric NodePath keys - #2097

Merged
robhogan merged 3 commits into
mainfrom
pr2097
Nov 23, 2026
Merged

robhogan merged 3 commits into
mainfrom
pr2097

Conversation

@robhogan

@robhogan robhogan commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Our generated @babel/types libdef was missing the node definition tables Babel exports (VISITOR_KEYS, NODE_FIELDS, etc.). This adds them to the generator, typed from the runtime values in Babel 7.29.

It also widens NodePath#key to string | number, matching Babel and @types/babel__traverse, since a path inside a list has its numeric index as its key. This removes the VISITOR_KEYS suppressions #2092 added in `inline-requires-plugin.js.

Diff train: RN's copies of the lib defs may need syncing

Changelog: Internal

Test plan:
Regenerated with yarn update-babel-flow-lib-defs - the only change to the generated file is the new declarations. React Native's copies of both libdefs are identical to ours, and RN's flow check is clean with the updated files dropped in.

Our generated `@babel/types` libdef was missing the node definition tables Babel exports (`VISITOR_KEYS`, `NODE_FIELDS`, etc.). This adds them to the generator, typed from the runtime values in Babel 7.29.

It also widens `NodePath#key` to `string | number`, since a path inside a list has its numeric index as its key. #2092 currently needs suppressions for both, which we'll remove in a follow-up.

Changelog: Internal

Test plan:
Regenerated with `yarn update-babel-flow-lib-defs` - the only change to the generated file is the new declarations. React Native's copies of both libdefs are identical to ours, and RN's `flow check` is clean with the updated files dropped in.
@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 Oct 23, 2026
@robhogan
robhogan merged commit 02e2ef4 into main Nov 23, 2026
16 checks passed
@robhogan
robhogan deleted the pr2097 branch November 23, 2026 16:44
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. needs-meta-import

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants