-
Notifications
You must be signed in to change notification settings - Fork 50.8k
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bugType: Bug
Description
What kind of issue is this?
- React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
- babel-plugin-react-compiler (build issue installing or using the Babel plugin)
- eslint-plugin-react-hooks (build issue installing or using the eslint plugin)
- react-compiler-healthcheck (build issue installing or using the healthcheck script)
Link to repro
Repro steps
- Compile a function with TypeScript overload signatures with gating enabled:
import { useStore } from "../stores/store";
// Overload signatures
export function useSession(): Session | null;
export function useSession<T>(selector: (session: Session) => T): T | null;
// Implementation
export function useSession<T>(
selector?: (session: Session) => T
): Session | T | null {
return useStore((s) => {
const session = s.session;
if (!session) return null;
return selector ? selector(session) : session;
});
}- The presence of overload signatures causes
exportto be placed on the wrong function:
// Wrong - unoptimized variant is exported
export function useSession_unoptimized<T>(...) { ... }
// Wrong - dispatcher is not exported
function useSession(arg0) { ... }Expected: useSession should be exported, not useSession_unoptimized
How often does this bug happen?
Every time
What version of React are you using?
19.2.4
What version of React Compiler are you using?
1.0.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bugType: Bug