From f72490cca2a0281ede338b770b34ccedc427a70c Mon Sep 17 00:00:00 2001 From: Moroine Bentefrit Date: Wed, 9 Oct 2019 19:44:23 +0800 Subject: [PATCH] Add back containsSpread --- lib/util/propTypes.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/util/propTypes.js b/lib/util/propTypes.js index 1d3ed3887f..c60f92c767 100644 --- a/lib/util/propTypes.js +++ b/lib/util/propTypes.js @@ -128,6 +128,7 @@ module.exports = function propTypesInstructions(context, components, utils) { ObjectTypeAnnotation(annotation, parentName, seen) { let containsUnresolvedObjectTypeSpread = false; + let containsSpread = false; const containsIndexers = Boolean(annotation.indexers && annotation.indexers.length); const shapeTypeDefinition = { type: 'shape', @@ -152,12 +153,15 @@ module.exports = function propTypesInstructions(context, components, utils) { } else { Object.assign(shapeTypeDefinition, types.children); } + containsSpread = true; }); // Mark if this shape has spread or an indexer. We will know to consider all props from this shape as having propTypes, // but still have the ability to detect unused children of this shape. shapeTypeDefinition.containsUnresolvedSpread = containsUnresolvedObjectTypeSpread; shapeTypeDefinition.containsIndexers = containsIndexers; + // Deprecated: containsSpread is not used anymore in the codebase, ensure to keep API backward compatibility + shapeTypeDefinition.containsSpread = containsSpread; return shapeTypeDefinition; },