mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Summary: We will soon be enforcing that flow suppressions will only apply when on an error's primary location ([post](https://fb.workplace.com/groups/179614562644215/permalink/559286354677032/)). This diff uses the codemod created in D20008770 to move all suppression comments to their primary locations in the `xplat/js` flow root, and deletes suppression comments that are not on any primary locations. This diff was generated with: ``` ~/fbsource/fbcode/flow/packages/flow-dev-tools/bin/tool suppression-primary-locations --json-file ~/www/errors.json ~/fbsource/xplat/js hg st -n | xargs grep -l -P '@(partially-)?generated' | xargs hg revert hg st -n | xargs grep -l 'format' | xargs prettier --write ``` Changelog: [Internal] bypass-lint Reviewed By: dsainati1 Differential Revision: D20122544 fbshipit-source-id: d94e409aadb18bb399a1ddbf9f3f2494fe4fb54c
82 lines
1.6 KiB
JavaScript
82 lines
1.6 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const StyleSheet = require('../StyleSheet');
|
|
|
|
import type {ImageStyleProp, TextStyleProp} from '../StyleSheet';
|
|
const imageStyle = {tintColor: 'rgb(0, 0, 0)'};
|
|
const textStyle = {color: 'rgb(0, 0, 0)'};
|
|
|
|
module.exports = {
|
|
testGoodCompose() {
|
|
(StyleSheet.compose(
|
|
imageStyle,
|
|
imageStyle,
|
|
): ImageStyleProp);
|
|
|
|
(StyleSheet.compose(
|
|
textStyle,
|
|
textStyle,
|
|
): TextStyleProp);
|
|
|
|
(StyleSheet.compose(
|
|
null,
|
|
null,
|
|
): TextStyleProp);
|
|
|
|
(StyleSheet.compose(
|
|
textStyle,
|
|
null,
|
|
): TextStyleProp);
|
|
|
|
(StyleSheet.compose(
|
|
textStyle,
|
|
Math.random() < 0.5 ? textStyle : null,
|
|
): TextStyleProp);
|
|
|
|
(StyleSheet.compose(
|
|
[textStyle],
|
|
null,
|
|
): TextStyleProp);
|
|
|
|
(StyleSheet.compose(
|
|
[textStyle],
|
|
null,
|
|
): TextStyleProp);
|
|
|
|
(StyleSheet.compose(
|
|
[textStyle],
|
|
[textStyle],
|
|
): TextStyleProp);
|
|
},
|
|
|
|
testBadCompose() {
|
|
// $FlowExpectedError - Incompatible type.
|
|
(StyleSheet.compose(
|
|
textStyle,
|
|
textStyle,
|
|
): ImageStyleProp);
|
|
|
|
// $FlowExpectedError - Incompatible type.
|
|
(StyleSheet.compose(
|
|
[textStyle],
|
|
null,
|
|
): ImageStyleProp);
|
|
|
|
// $FlowExpectedError - Incompatible type.
|
|
(StyleSheet.compose(
|
|
Math.random() < 0.5 ? textStyle : null,
|
|
null,
|
|
): ImageStyleProp);
|
|
},
|
|
};
|