Skip to content

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Sep 21, 2025

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 facebook:main Sep 22, 2025
30 checks passed
@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
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