Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
AirbnbPropTypes.requiredBy('foo', PropTypes.string);
// $ExpectType Validator
AirbnbPropTypes.requiredBy('bar', PropTypes.number, 42).isRequired;
validateRequireableTop(AirbnbPropTypes.restrictedProp());
validateRequireableTop(AirbnbPropTypes.restrictedProp(() => 'Error'));
validateRequireableTop(AirbnbPropTypes.restrictedProp(() => new Error('Error')));
validateRequireableTop(AirbnbPropTypes.sequenceOf({ validator: PropTypes.number }));
import React from 'react';
import PropTypes from 'prop-types';
import { forbidExtraProps, range } from 'airbnb-prop-types';
import classnames from 'classnames';
const propTypes = forbidExtraProps({
children: PropTypes.node.isRequired,
level: range(1, 7),
});
const defaultProps = {
level: 2,
};
const Title = ({
children,
level,
}) => {
const Level = `h${level}`;
return (