How to use the airbnb-prop-types.nChildren 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.mutuallyExclusiveProps(PropTypes.number);
// $ExpectType Requireable
AirbnbPropTypes.mutuallyExclusiveProps(PropTypes.number, 'foo');
// $ExpectType Requireable
AirbnbPropTypes.mutuallyExclusiveProps(PropTypes.string, 'foo', 'bar');

// $ExpectType Requireable
AirbnbPropTypes.mutuallyExclusiveTrueProps('foo');
// $ExpectType Requireable
AirbnbPropTypes.mutuallyExclusiveTrueProps('foo', 'bar');

// $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]);
github DefinitelyTyped / DefinitelyTyped / types / airbnb-prop-types / airbnb-prop-types-tests.ts View on Github external
validateRequireableTop(AirbnbPropTypes.keysOf(PropTypes.oneOf(['foo', 'bar'])));

// $ExpectType Requireable
AirbnbPropTypes.mutuallyExclusiveProps(PropTypes.number);
// $ExpectType Requireable
AirbnbPropTypes.mutuallyExclusiveProps(PropTypes.number, 'foo');
// $ExpectType Requireable
AirbnbPropTypes.mutuallyExclusiveProps(PropTypes.string, 'foo', 'bar');

// $ExpectType Requireable
AirbnbPropTypes.mutuallyExclusiveTrueProps('foo');
// $ExpectType Requireable
AirbnbPropTypes.mutuallyExclusiveTrueProps('foo', 'bar');

// $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 }>();