1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @flow
    
  8.  */
    
  9. 
    
  10. import assign from 'shared/assign';
    
  11. 
    
  12. export function resolveDefaultProps(Component: any, baseProps: Object): Object {
    
  13.   if (Component && Component.defaultProps) {
    
  14.     // Resolve default props. Taken from ReactElement
    
  15.     const props = assign({}, baseProps);
    
  16.     const defaultProps = Component.defaultProps;
    
  17.     for (const propName in defaultProps) {
    
  18.       if (props[propName] === undefined) {
    
  19.         props[propName] = defaultProps[propName];
    
  20.       }
    
  21.     }
    
  22.     return props;
    
  23.   }
    
  24.   return baseProps;
    
  25. }