How to use the airbnb-prop-types.object function in airbnb-prop-types

To help you get started, we’ve selected a few airbnb-prop-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / airbnb-prop-types / airbnb-prop-types-tests.ts View on Github external
// $ExpectType Requireable
AirbnbPropTypes.nChildren(1, PropTypes.number);
// $ExpectType Requireable
AirbnbPropTypes.nChildren(1, AirbnbPropTypes.childrenOfType('span'));

// $ExpectType Requireable
AirbnbPropTypes.nonNegativeInteger;

// $ExpectType Requireable
AirbnbPropTypes.nonNegativeNumber();

// $ExpectType Requireable
AirbnbPropTypes.numericString();

// $ExpectType Requireable
const props: PropTypes.Requireable = AirbnbPropTypes.object();
// $ExpectType Requireable<{ foo: string; }>
AirbnbPropTypes.object<{ foo: string }>();

AirbnbPropTypes.or([PropTypes.bool.isRequired, AirbnbPropTypes.explicitNull().isRequired]);
AirbnbPropTypes.or([PropTypes.bool, PropTypes.number, PropTypes.arrayOf(PropTypes.string)]);
AirbnbPropTypes.or([PropTypes.number, PropTypes.string, PropTypes.bool], 'foo');

// $ExpectType Requireable
AirbnbPropTypes.range(0, 10);
// $ExpectType Requireable<5>
AirbnbPropTypes.range<5>(0, 10);

// $ExpectType Requireable>
AirbnbPropTypes.ref();

// $ExpectType Requireable
github massgov / mayflower / react / src / components / organisms / Header / index.js View on Github external
);
  }
}

Header.propTypes = {
  /** imports the utilityNav component */
  utilityNav: PropTypes.shape(UtilityNav.propTypes).isRequired,
  /** imports the headersearch component */
  headerSearch: PropTypes.oneOfType([PropTypes.shape(HeaderSearch.propTypes), PropTypes.func]).isRequired,
  searchRedirect: PropTypes.shape({
    /** The base url that the user is redirected to when submitting a non-empty search value. */
    baseUrl: PropTypes.string,
    /** The URL query parameter that will be set to the value of the search input element. */
    searchTermParam: PropTypes.string,
    /** Optional extra query parameters to add to the redirect baseUrl. */
    queryParams: airbnbPropTypes.object
  }),
  /** imports the mainnav component */
  mainNav: PropTypes.shape(MainNav.propTypes).isRequired,
  /** Adds a prop to hide header search in the header */
  hideHeaderSearch: PropTypes.bool,
  /** Adds a prop to not display go back to classic.mass.gov */
  hideBackTo: PropTypes.bool,
  /** siteLogo can be either a render prop or the SiteLogo component */
  siteLogo: PropTypes.oneOfType([PropTypes.shape(SiteLogo.propTypes), PropTypes.func])
};

Header.defaultProps = {
  hideHeaderSearch: false,
  hideBackTo: true,
  siteLogo: {
    url: {