From d4300cb59b13b91eb8ebc19b83042565bf7de23e Mon Sep 17 00:00:00 2001 From: Amir Sharif Date: Mon, 4 Mar 2019 12:15:16 -0800 Subject: [PATCH] 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 --- Libraries/YellowBox/Data/YellowBoxRegistry.js | 2 +- Libraries/YellowBox/YellowBox.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/YellowBox/Data/YellowBoxRegistry.js b/Libraries/YellowBox/Data/YellowBoxRegistry.js index 0c98ca00fa5..b6a445f893a 100644 --- a/Libraries/YellowBox/Data/YellowBoxRegistry.js +++ b/Libraries/YellowBox/Data/YellowBoxRegistry.js @@ -18,7 +18,7 @@ export type Registry = Map>; export type Observer = (registry: Registry) => void; -type IgnorePattern = string | RegExp; +export type IgnorePattern = string | RegExp; export type Subscription = $ReadOnly<{| unsubscribe: () => void, diff --git a/Libraries/YellowBox/YellowBox.js b/Libraries/YellowBox/YellowBox.js index 0b6768110e8..4f7d4128412 100644 --- a/Libraries/YellowBox/YellowBox.js +++ b/Libraries/YellowBox/YellowBox.js @@ -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 { - static ignoreWarnings(patterns: $ReadOnlyArray): void { + static ignoreWarnings(patterns: $ReadOnlyArray): void { YellowBoxRegistry.addIgnorePatterns(patterns); } @@ -135,7 +135,7 @@ if (__DEV__) { }; } else { YellowBox = class extends React.Component { - static ignoreWarnings(patterns: $ReadOnlyArray): void { + static ignoreWarnings(patterns: $ReadOnlyArray): void { // Do nothing. }