Fix string casting and remove Flow suppression comments

This commit is contained in:
Andrew Clark 2017-03-01 11:08:08 -08:00
parent d1ee199492
commit 5e5bc69230
5 changed files with 6 additions and 12 deletions

View File

@ -117,8 +117,6 @@ function coerceRef(current: Fiber | null, element: ReactElement) {
function throwOnInvalidObjectType(returnFiber : Fiber, newChild : Object) {
if (returnFiber.type !== 'textarea') {
// $FlowFixMe - Intentional cast to string
const childrenString = '' + newChild;
let addendum = '';
if (__DEV__) {
addendum =
@ -136,9 +134,9 @@ function throwOnInvalidObjectType(returnFiber : Fiber, newChild : Object) {
invariant(
false,
'Objects are not valid as a React child (found: %s).%s',
childrenString === '[object Object]' ?
Object.prototype.toString.call(newChild) === '[object Object]' ?
'object with keys {' + Object.keys(newChild).join(', ') + '}' :
childrenString,
newChild,
addendum
);
}

View File

@ -47,8 +47,7 @@ if (__DEV__) {
'%s(...): Expected the last optional `callback` argument to be a ' +
'function. Instead received: %s.',
callerName,
// $FlowFixMe - Intentional cast to string
'' + callback
callback
);
};
}

View File

@ -168,8 +168,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
callback === null || typeof callback === 'function',
'render(...): Expected the last optional `callback` argument to be a ' +
'function. Instead received: %s.',
// $FlowFixMe - Intentional cast to string
'' + callback
callback
);
}
addTopLevelUpdate(current, nextState, callback, priorityLevel);

View File

@ -470,8 +470,7 @@ function commitCallbacks(finishedWork : Fiber, queue : UpdateQueue, context : mi
typeof callback === 'function',
'Invalid argument passed as callback. Expected a function. Instead ' +
'received: %s',
// $FlowFixMe - Intentional cast to string
'' + callback
callback
);
callback.call(context);
}

View File

@ -19,8 +19,7 @@ function validateCallback(callback: ?Function) {
!callback || typeof callback === 'function',
'Invalid argument passed as callback. Expected a function. Instead ' +
'received: %s',
// $FlowFixMe - Intentional cast to string
'' + callback
callback
);
}