mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix string casting and remove Flow suppression comments
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user