Update typing for YellowBox patterns

Summary: To satisfy Flow, we want to account for RegExp as a valid ignore pattern.

Reviewed By: TheSavior

Differential Revision: D14303072

fbshipit-source-id: 4988fff5c6c6a12da99027e47216cedcf5a4db5a
This commit is contained in:
Amir Sharif
2019-03-04 12:15:16 -08:00
committed by Facebook Github Bot
parent 2c0125995d
commit d4300cb59b
2 changed files with 4 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ export type Registry = Map<Category, $ReadOnlyArray<YellowBoxWarning>>;
export type Observer = (registry: Registry) => void;
type IgnorePattern = string | RegExp;
export type IgnorePattern = string | RegExp;
export type Subscription = $ReadOnly<{|
unsubscribe: () => void,

View File

@@ -13,7 +13,7 @@
const React = require('React');
import type {Category} from 'YellowBoxCategory';
import type {Registry, Subscription} from 'YellowBoxRegistry';
import type {Registry, Subscription, IgnorePattern} from 'YellowBoxRegistry';
type Props = $ReadOnly<{||}>;
type State = {|
@@ -50,7 +50,7 @@ if (__DEV__) {
// eslint-disable-next-line no-shadow
YellowBox = class YellowBox extends React.Component<Props, State> {
static ignoreWarnings(patterns: $ReadOnlyArray<string>): void {
static ignoreWarnings(patterns: $ReadOnlyArray<IgnorePattern>): void {
YellowBoxRegistry.addIgnorePatterns(patterns);
}
@@ -135,7 +135,7 @@ if (__DEV__) {
};
} else {
YellowBox = class extends React.Component<Props> {
static ignoreWarnings(patterns: $ReadOnlyArray<string>): void {
static ignoreWarnings(patterns: $ReadOnlyArray<IgnorePattern>): void {
// Do nothing.
}