Make sure .createElement({}) warns (#7857)

This is common when forgetting to export anything from a file.
This commit is contained in:
Ben Alpert
2016-10-03 17:24:57 -07:00
committed by GitHub
parent 23cd77b683
commit be63afcb64
@@ -183,8 +183,10 @@ function validatePropTypes(element) {
var ReactElementValidator = {
createElement: function(type, props, children) {
var validType = typeof type === 'string' || typeof type === 'function' ||
(type !== null && typeof type === 'object');
var validType =
typeof type === 'string' ||
typeof type === 'function' ||
type !== null && typeof type === 'object' && typeof type.tag === 'number';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
if (!validType) {