Skip to content

Commit 7c0f9a2

Browse files
author
Sebastian Silbermann
committed
Flow
1 parent 8edecc0 commit 7c0f9a2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/react-dom-bindings/src/client/ReactDOMComponent.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ function normalizeMarkupForTextOrAttribute(markup: mixed): string {
326326

327327
export function checkForUnmatchedText(
328328
serverText: string,
329-
clientText: string | number,
329+
clientText: string | number | bigint,
330330
isConcurrentMode: boolean,
331331
shouldWarnDev: boolean,
332332
) {
@@ -399,10 +399,12 @@ function setProp(
399399
}
400400
} else if (typeof value === 'number' || typeof value === 'bigint') {
401401
if (__DEV__) {
402+
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
402403
validateTextNesting('' + value, tag);
403404
}
404405
const canSetTextContent = tag !== 'body';
405406
if (canSetTextContent) {
407+
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
406408
setTextContent(domElement, '' + value);
407409
}
408410
}
@@ -954,6 +956,7 @@ function setPropOnCustomElement(
954956
if (typeof value === 'string') {
955957
setTextContent(domElement, value);
956958
} else if (typeof value === 'number' || typeof value === 'bigint') {
959+
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
957960
setTextContent(domElement, '' + value);
958961
}
959962
break;
@@ -2817,6 +2820,7 @@ export function diffHydratedProperties(
28172820
typeof children === 'number' ||
28182821
typeof children === 'bigint'
28192822
) {
2823+
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
28202824
if (domElement.textContent !== '' + children) {
28212825
if (props.suppressHydrationWarning !== true) {
28222826
checkForUnmatchedText(

packages/react-reconciler/src/ReactChildFiber.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ function createChildReconciler(
565565
// we can continue to replace it without aborting even if it is not a text
566566
// node.
567567
const created = createFiberFromText(
568+
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
568569
'' + newChild,
569570
returnFiber.mode,
570571
lanes,
@@ -688,6 +689,7 @@ function createChildReconciler(
688689
return updateTextNode(
689690
returnFiber,
690691
oldFiber,
692+
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
691693
'' + newChild,
692694
lanes,
693695
debugInfo,
@@ -806,6 +808,7 @@ function createChildReconciler(
806808
return updateTextNode(
807809
returnFiber,
808810
matchedFiber,
811+
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
809812
'' + newChild,
810813
lanes,
811814
debugInfo,
@@ -1617,6 +1620,7 @@ function createChildReconciler(
16171620
reconcileSingleTextNode(
16181621
returnFiber,
16191622
currentFirstChild,
1623+
// $FlowFixMe[unsafe-addition] Flow doesn't want us to use `+` operator with string and bigint
16201624
'' + newChild,
16211625
lanes,
16221626
),

0 commit comments

Comments
 (0)