From ab07e94d94749a9f9ecf62a40bf06827f3a17aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Mon, 29 Aug 2016 19:21:39 -0700 Subject: [PATCH] Cleanup ReactErrorUtils This cleans up the Flow annotations and brings the implementations in line. --- src/renderers/shared/utils/ReactErrorUtils.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/renderers/shared/utils/ReactErrorUtils.js b/src/renderers/shared/utils/ReactErrorUtils.js index f8d3f30ed147..25bed212bb84 100644 --- a/src/renderers/shared/utils/ReactErrorUtils.js +++ b/src/renderers/shared/utils/ReactErrorUtils.js @@ -22,19 +22,17 @@ var caughtError = null; * @param {*} a First argument * @param {*} b Second argument */ -function invokeGuardedCallback( +function invokeGuardedCallback( name: string, - func: (a: A, b: B) => C, + func: (a: A) => void, a: A, - b: B, -): ?C { +): void { try { - return func(a, b); + func(a); } catch (x) { if (caughtError === null) { caughtError = x; } - return undefined; } } @@ -70,13 +68,12 @@ if (__DEV__) { typeof document !== 'undefined' && typeof document.createEvent === 'function') { var fakeNode = document.createElement('react'); - ReactErrorUtils.invokeGuardedCallback = function( + ReactErrorUtils.invokeGuardedCallback = function( name: string, - func: (a: A, b: B) => C, + func: (a: A) => void, a: A, - b: B, - ): ?C { - var boundFunc = func.bind(null, a, b); + ): void { + var boundFunc = func.bind(null, a); var evtType = `react-${name}`; fakeNode.addEventListener(evtType, boundFunc, false); var evt = document.createEvent('Event');