Skip to content

Fix string casting and remove Flow suppression comments #9087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2017
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions src/renderers/shared/fiber/ReactChildFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shared/fiber/ReactFiberClassComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
};
}
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shared/fiber/ReactFiberReconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shared/fiber/ReactFiberUpdateQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 1 addition & 2 deletions src/renderers/shared/utils/validateCallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand Down