Removed unnecessary if (#9031)
Maxwel D'souza committed
Feb 24, 2017 at 02:44 UTC
b81175d37a68e7414344d39859958415371f9c05
1 file changed
+24
-29
src/isomorphic/classic/element/ReactElementValidator.js
+24
-29
@@ -204,40 +204,35 @@ var ReactElementValidator = {
204
// We warn in this case but don't throw. We expect the element creation to
205
// succeed and there will likely be errors in render.
206
if (!validType) {
207
+ var info = '';
208
if (
208
- typeof type !== 'function' &&
209
- typeof type !== 'string'
209
+ type === undefined ||
210
+ typeof type === 'object' &&
211
+ type !== null &&
212
+ Object.keys(type).length === 0
213
) {
211
- var info = '';
212
- if (
213
- type === undefined ||
214
- typeof type === 'object' &&
215
- type !== null &&
216
- Object.keys(type).length === 0
217
- ) {
218
- info +=
219
- ' You likely forgot to export your component from the file ' +
220
- 'it\'s defined in.';
221
- }
214
+ info +=
215
+ ' You likely forgot to export your component from the file ' +
216
+ 'it\'s defined in.';
217
+ }
218
223
- var sourceInfo = getSourceInfoErrorAddendum(props);
224
- if (sourceInfo) {
225
- info += sourceInfo;
226
- } else {
227
- info += getDeclarationErrorAddendum();
228
- }
219
+ var sourceInfo = getSourceInfoErrorAddendum(props);
220
+ if (sourceInfo) {
221
+ info += sourceInfo;
222
+ } else {
223
+ info += getDeclarationErrorAddendum();
224
+ }
225
230
- info += ReactComponentTreeHook.getCurrentStackAddendum();
226
+ info += ReactComponentTreeHook.getCurrentStackAddendum();
227
232
- warning(
233
- false,
234
- 'React.createElement: type is invalid -- expected a string (for ' +
235
- 'built-in components) or a class/function (for composite ' +
236
- 'components) but got: %s.%s',
237
- type == null ? type : typeof type,
238
- info,
239
- );
240
- }
228
+ warning(
229
+ false,
230
+ 'React.createElement: type is invalid -- expected a string (for ' +
231
+ 'built-in components) or a class/function (for composite ' +
232
+ 'components) but got: %s.%s',
233
+ type == null ? type : typeof type,
234
+ info,
235
+ );
236
}
237
238
var element = ReactElement.createElement.apply(this, arguments);