Skip to content

Commit da9136f

Browse files
marcoww6facebook-github-bot
authored andcommitted
Turn on null strict comparison check for xplat js (#53379)
Summary: Pull Request resolved: #53379 X-link: facebook/react#34240 Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D80648362 fbshipit-source-id: cc47ae207f29a3ddb68bc0e029b8773f89503c52
1 parent ffe52b7 commit da9136f

File tree

9 files changed

+31
-5
lines changed

9 files changed

+31
-5
lines changed

packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,17 @@ function setDefaultValue(
350350
common.default = ((defaultValue ? defaultValue : 0): number);
351351
break;
352352
case 'FloatTypeAnnotation':
353+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
354+
* roll out. See https://fburl.com/workplace/5whu3i34. */
353355
common.default = ((defaultValue === null
354356
? null
355357
: defaultValue
356358
? defaultValue
357359
: 0): number | null);
358360
break;
359361
case 'BooleanTypeAnnotation':
362+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
363+
* roll out. See https://fburl.com/workplace/5whu3i34. */
360364
common.default = defaultValue === null ? null : !!defaultValue;
361365
break;
362366
case 'StringTypeAnnotation':

packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ const ActionSheetIOS = {
7777
callback: (buttonIndex: number) => void,
7878
) {
7979
invariant(
80+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
81+
* roll out. See https://fburl.com/workplace/5whu3i34. */
8082
typeof options === 'object' && options !== null,
8183
'Options must be a valid object',
8284
);
@@ -162,6 +164,8 @@ const ActionSheetIOS = {
162164
successCallback: Function | ((success: boolean, method: ?string) => void),
163165
) {
164166
invariant(
167+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
168+
* roll out. See https://fburl.com/workplace/5whu3i34. */
165169
typeof options === 'object' && options !== null,
166170
'Options must be a valid object',
167171
);

packages/react-native/Libraries/Blob/URLSearchParams.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export class URLSearchParams {
1818
}
1919

2020
constructor(params?: Record<string, string> | string | [string, string][]) {
21+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
22+
* roll out. See https://fburl.com/workplace/5whu3i34. */
2123
if (params === null) {
2224
return;
2325
}

packages/react-native/Libraries/Share/Share.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ class Share {
8383
options?: ShareOptions = {},
8484
): Promise<{action: string, activityType: ?string}> {
8585
invariant(
86+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
87+
* roll out. See https://fburl.com/workplace/5whu3i34. */
8688
typeof content === 'object' && content !== null,
8789
'Content to share must be a valid object',
8890
);
@@ -91,6 +93,8 @@ class Share {
9193
'At least one of URL or message is required',
9294
);
9395
invariant(
96+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
97+
* roll out. See https://fburl.com/workplace/5whu3i34. */
9498
typeof options === 'object' && options !== null,
9599
'Options must be a valid object',
96100
);

packages/react-native/Libraries/Utilities/HMRClient.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ const HMRClient: HMRClientNativeInterface = {
165165
// Moving to top gives errors due to NativeModules not being initialized
166166
const DevLoadingView = require('./DevLoadingView').default;
167167

168+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
169+
* roll out. See https://fburl.com/workplace/5whu3i34. */
168170
const serverHost = port !== null && port !== '' ? `${host}:${port}` : host;
169171

170172
const serverScheme = scheme;

packages/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<mixed>>(
3333
if (__DEV__) {
3434
if (
3535
typeof object !== 'object' ||
36+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
37+
* roll out. See https://fburl.com/workplace/5whu3i34. */
3638
object === null ||
3739
Object.isFrozen(object) ||
3840
Object.isSealed(object)

packages/react-native/Libraries/WebSocket/WebSocketInterceptor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ const WebSocketInterceptor = {
232232

233233
_arrayBufferToString(data: string): ArrayBuffer | string {
234234
const value = base64.toByteArray(data).buffer;
235+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
236+
* roll out. See https://fburl.com/workplace/5whu3i34. */
235237
if (value === undefined || value === null) {
236238
return '(no value)';
237239
}

packages/rn-tester/js/examples/Text/TextSharedExamples.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ function InlineView(props: {
2828
<RNTesterText style={{fontWeight: 'bold'}}>Child</RNTesterText>
2929
<View style={{width: 30, height: 30, backgroundColor: 'red'}} />
3030
<RNTesterText style={{fontWeight: 'bold'}}>Child</RNTesterText>
31-
{props !== null && props.long === true && (
32-
<RNTesterText style={{fontWeight: 'bold'}}>
33-
aaaa a aaaa aaaaaa aaa a a a aaaaa sdsds dsdSAD asd ASDasd ASDas
34-
</RNTesterText>
35-
)}
31+
{
32+
/* $FlowFixMe[invalid-compare] Error discovered during Constant
33+
* Condition roll out. See https://fburl.com/workplace/5whu3i34. */
34+
props !== null && props.long === true && (
35+
<RNTesterText style={{fontWeight: 'bold'}}>
36+
aaaa a aaaa aaaaaa aaa a a a aaaaa sdsds dsdSAD asd ASDasd ASDas
37+
</RNTesterText>
38+
)
39+
}
3640
</RNTesterText>
3741
</View>
3842
);

private/react-native-fantom/src/getFantomRenderedOutput.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ function convertRawJsonToJSX(
136136
actualJSON: FantomJsonObject | $ReadOnlyArray<FantomJsonObject>,
137137
): React.Node {
138138
let actualJSX;
139+
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
140+
* roll out. See https://fburl.com/workplace/5whu3i34. */
139141
if (actualJSON === null || typeof actualJSON === 'string') {
140142
actualJSX = actualJSON;
141143
} else if (Array.isArray(actualJSON)) {

0 commit comments

Comments
 (0)