From be63afcb6448469072a329d427c39a11c1d7df2b Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Mon, 3 Oct 2016 17:24:57 -0700 Subject: [PATCH] Make sure .createElement({}) warns (#7857) This is common when forgetting to export anything from a file. --- src/isomorphic/classic/element/ReactElementValidator.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/isomorphic/classic/element/ReactElementValidator.js b/src/isomorphic/classic/element/ReactElementValidator.js index a899654153..3f7f717715 100644 --- a/src/isomorphic/classic/element/ReactElementValidator.js +++ b/src/isomorphic/classic/element/ReactElementValidator.js @@ -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) {