Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions src/renderers/shared/utils/ReactErrorUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,17 @@ var caughtError = null;
* @param {*} a First argument
* @param {*} b Second argument
*/
function invokeGuardedCallback<A, B, C>(
function invokeGuardedCallback<A>(
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;
}
}

Expand Down Expand Up @@ -70,13 +68,12 @@ if (__DEV__) {
typeof document !== 'undefined' &&
typeof document.createEvent === 'function') {
var fakeNode = document.createElement('react');
ReactErrorUtils.invokeGuardedCallback = function<A, B, C>(
ReactErrorUtils.invokeGuardedCallback = function<A>(
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');
Expand Down