Skip to content

Commit c869063

Browse files
authored
[compiler] Add fire to known React APIs (#31795)
Makes `fire` a known export for type-based analysis -- --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31795). * #31811 * #31798 * #31797 * #31796 * __->__ #31795 * #31794
1 parent 308be6e commit c869063

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {Effect, ValueKind, ValueReason} from './HIR';
99
import {
1010
BUILTIN_SHAPES,
1111
BuiltInArrayId,
12+
BuiltInFireId,
1213
BuiltInMixedReadonlyId,
1314
BuiltInUseActionStateId,
1415
BuiltInUseContextHookId,
@@ -468,6 +469,21 @@ const REACT_APIS: Array<[string, BuiltInType]> = [
468469
BuiltInUseOperatorId,
469470
),
470471
],
472+
[
473+
'fire',
474+
addFunction(
475+
DEFAULT_SHAPES,
476+
[],
477+
{
478+
positionalParams: [],
479+
restParam: null,
480+
returnType: {kind: 'Primitive'},
481+
calleeEffect: Effect.Read,
482+
returnValueKind: ValueKind.Frozen,
483+
},
484+
BuiltInFireId,
485+
),
486+
],
471487
];
472488

473489
TYPED_GLOBALS.push(

compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ export const BuiltInDispatchId = 'BuiltInDispatch';
213213
export const BuiltInUseContextHookId = 'BuiltInUseContextHook';
214214
export const BuiltInUseTransitionId = 'BuiltInUseTransition';
215215
export const BuiltInStartTransitionId = 'BuiltInStartTransition';
216+
export const BuiltInFireId = 'BuiltInFire';
216217

217218
// ShapeRegistry with default definitions for built-ins.
218219
export const BUILTIN_SHAPES: ShapeRegistry = new Map();

0 commit comments

Comments
 (0)