Skip to content

[compiler] Don't leak global __DEV__ type - #34551

Merged
eps1lon merged 1 commit into
react:mainfrom
eps1lon:sebbie/09-21-_compiler_don_t_leak_global___dev___types
Sep 22, 2025
Merged

eps1lon merged 1 commit into
react:mainfrom
eps1lon:sebbie/09-21-_compiler_don_t_leak_global___dev___types

Conversation

@eps1lon

@eps1lon eps1lon commented Sep 21, 2025

Copy link
Copy Markdown
Collaborator

babel-plugin-react-compiler is not providing a global __DEV__ so it shouldn't declare its type. Whatever is providing this global should declare the types.

This prevents including __DEV__ in autocomplete when that variable may never be available.
This was especially problematic if you had an existing __DEV__ declared because then babel-plugin-react-compiler would fail since you can't re-declare block scoped variables.

Diff for dist/index.d.ts

 declare global {
-  let __DEV__: boolean | null | undefined;
 }

@meta-cla meta-cla Bot added the CLA Signed label Sep 21, 2025
@github-actions github-actions Bot added the React Core Team Opened by a member of the React Core Team label Sep 21, 2025
@eps1lon eps1lon changed the title [compiler] Don't leak global __DEV__ types [compiler] Don't leak global __DEV__ type Sep 21, 2025
@eps1lon
eps1lon marked this pull request as ready for review September 21, 2025 11:39
@eps1lon
eps1lon merged commit 07e4974 into react:main Sep 22, 2025
@eps1lon
eps1lon deleted the sebbie/09-21-_compiler_don_t_leak_global___dev___types branch September 22, 2025 14:52
github-actions Bot pushed a commit that referenced this pull request Sep 22, 2025
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants