Skip to content

Commit 25b6409

Browse files
committed
Support null as value
1 parent f3afb13 commit 25b6409

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/packages/babel-plugin-react-compiler/src/Optimization/ConstantPropagation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ function evaluateInstruction(
540540

541541
const expressionValue = subExprValue.value;
542542
if (
543-
typeof expressionValue === 'object' ||
543+
(typeof expressionValue === 'object' && expressionValue !== null) ||
544544
typeof expressionValue === 'symbol' ||
545545
typeof expressionValue === 'function'
546546
) {

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/constant-propagation-template-literal.expect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function foo() {
9999
`${[1, 2, 3]}`,
100100
"true",
101101
"false",
102-
`${null}`,
102+
"null",
103103
`${undefined}`,
104104
"1234567890",
105105
"0123456789",

0 commit comments

Comments
 (0)