Skip to content

Commit cb70b73

Browse files
committed
feat(babel-plugin-react-compiler): support satisfies operator (#32742)
Solve #29818 --------- Co-authored-by: Rodrigo Faria <rodrigo.faria@cartrack.com> DiffTrain build for [ef4bc8b](ef4bc8b)
1 parent 0c1b2bf commit cb70b73

35 files changed

+106
-87
lines changed

compiled/eslint-plugin-react-hooks/index.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31354,6 +31354,19 @@ function lowerExpression(builder, exprPath) {
3135431354
kind: 'TypeCastExpression',
3135531355
value: lowerExpressionToTemporary(builder, expr.get('expression')),
3135631356
typeAnnotation: typeAnnotation.node,
31357+
typeAnnotationKind: 'cast',
31358+
type: lowerType(typeAnnotation.node),
31359+
loc: exprLoc,
31360+
};
31361+
}
31362+
case 'TSSatisfiesExpression': {
31363+
let expr = exprPath;
31364+
const typeAnnotation = expr.get('typeAnnotation');
31365+
return {
31366+
kind: 'TypeCastExpression',
31367+
value: lowerExpressionToTemporary(builder, expr.get('expression')),
31368+
typeAnnotation: typeAnnotation.node,
31369+
typeAnnotationKind: 'satisfies',
3135731370
type: lowerType(typeAnnotation.node),
3135831371
loc: exprLoc,
3135931372
};
@@ -31365,6 +31378,7 @@ function lowerExpression(builder, exprPath) {
3136531378
kind: 'TypeCastExpression',
3136631379
value: lowerExpressionToTemporary(builder, expr.get('expression')),
3136731380
typeAnnotation: typeAnnotation.node,
31381+
typeAnnotationKind: 'as',
3136831382
type: lowerType(typeAnnotation.node),
3136931383
loc: exprLoc,
3137031384
};
@@ -43346,7 +43360,12 @@ function codegenInstructionValue(cx, instrValue) {
4334643360
}
4334743361
case 'TypeCastExpression': {
4334843362
if (libExports.isTSType(instrValue.typeAnnotation)) {
43349-
value = libExports.tsAsExpression(codegenPlaceToExpression(cx, instrValue.value), instrValue.typeAnnotation);
43363+
if (instrValue.typeAnnotationKind === 'satisfies') {
43364+
value = libExports.tsSatisfiesExpression(codegenPlaceToExpression(cx, instrValue.value), instrValue.typeAnnotation);
43365+
}
43366+
else {
43367+
value = libExports.tsAsExpression(codegenPlaceToExpression(cx, instrValue.value), instrValue.typeAnnotation);
43368+
}
4335043369
}
4335143370
else {
4335243371
value = libExports.typeCastExpression(codegenPlaceToExpression(cx, instrValue.value), libExports.typeAnnotation(instrValue.typeAnnotation));

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8039f1b2a05d00437cd29707761aeae098c80adc
1+
ef4bc8b4f91023afac437be9179beef350b32db3
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8039f1b2a05d00437cd29707761aeae098c80adc
1+
ef4bc8b4f91023afac437be9179beef350b32db3

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ __DEV__ &&
15111511
exports.useTransition = function () {
15121512
return resolveDispatcher().useTransition();
15131513
};
1514-
exports.version = "19.1.0-www-classic-8039f1b2-20250327";
1514+
exports.version = "19.1.0-www-classic-ef4bc8b4-20250328";
15151515
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15161516
"function" ===
15171517
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ __DEV__ &&
15111511
exports.useTransition = function () {
15121512
return resolveDispatcher().useTransition();
15131513
};
1514-
exports.version = "19.1.0-www-modern-8039f1b2-20250327";
1514+
exports.version = "19.1.0-www-modern-ef4bc8b4-20250328";
15151515
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15161516
"function" ===
15171517
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,4 +624,4 @@ exports.useSyncExternalStore = function (
624624
exports.useTransition = function () {
625625
return ReactSharedInternals.H.useTransition();
626626
};
627-
exports.version = "19.1.0-www-classic-8039f1b2-20250327";
627+
exports.version = "19.1.0-www-classic-ef4bc8b4-20250328";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,4 +624,4 @@ exports.useSyncExternalStore = function (
624624
exports.useTransition = function () {
625625
return ReactSharedInternals.H.useTransition();
626626
};
627-
exports.version = "19.1.0-www-modern-8039f1b2-20250327";
627+
exports.version = "19.1.0-www-modern-ef4bc8b4-20250328";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ exports.useSyncExternalStore = function (
628628
exports.useTransition = function () {
629629
return ReactSharedInternals.H.useTransition();
630630
};
631-
exports.version = "19.1.0-www-classic-8039f1b2-20250327";
631+
exports.version = "19.1.0-www-classic-ef4bc8b4-20250328";
632632
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
633633
"function" ===
634634
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ exports.useSyncExternalStore = function (
628628
exports.useTransition = function () {
629629
return ReactSharedInternals.H.useTransition();
630630
};
631-
exports.version = "19.1.0-www-modern-8039f1b2-20250327";
631+
exports.version = "19.1.0-www-modern-ef4bc8b4-20250328";
632632
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
633633
"function" ===
634634
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18200,10 +18200,10 @@ __DEV__ &&
1820018200
(function () {
1820118201
var internals = {
1820218202
bundleType: 1,
18203-
version: "19.1.0-www-classic-8039f1b2-20250327",
18203+
version: "19.1.0-www-classic-ef4bc8b4-20250328",
1820418204
rendererPackageName: "react-art",
1820518205
currentDispatcherRef: ReactSharedInternals,
18206-
reconcilerVersion: "19.1.0-www-classic-8039f1b2-20250327"
18206+
reconcilerVersion: "19.1.0-www-classic-ef4bc8b4-20250328"
1820718207
};
1820818208
internals.overrideHookState = overrideHookState;
1820918209
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -18237,7 +18237,7 @@ __DEV__ &&
1823718237
exports.Shape = Shape;
1823818238
exports.Surface = Surface;
1823918239
exports.Text = Text;
18240-
exports.version = "19.1.0-www-classic-8039f1b2-20250327";
18240+
exports.version = "19.1.0-www-classic-ef4bc8b4-20250328";
1824118241
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1824218242
"function" ===
1824318243
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)