Skip to content

Commit

Permalink
Add back containsSpread
Browse files Browse the repository at this point in the history
  • Loading branch information
moroine committed Oct 9, 2019
1 parent 39eddbe commit f72490c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/util/propTypes.js
Expand Up @@ -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',
Expand All @@ -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;
},
Expand Down

0 comments on commit f72490c

Please sign in to comment.