Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 }));
validateRequireableTop(AirbnbPropTypes.sequenceOf({ validator: PropTypes.number }, { validator: PropTypes.string }));
validateRequireableTop(AirbnbPropTypes.sequenceOf(
{ validator: PropTypes.number, min: 0, max: 10 },
{ validator: PropTypes.string },
{ validator: PropTypes.bool },
));
interface ShapeShape {
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 }));
validateRequireableTop(AirbnbPropTypes.sequenceOf({ validator: PropTypes.number }, { validator: PropTypes.string }));
validateRequireableTop(AirbnbPropTypes.sequenceOf(
{ validator: PropTypes.number, min: 0, max: 10 },
{ validator: PropTypes.string },
{ validator: PropTypes.bool },
));
interface ShapeShape {
foo: string;
bar?: number | null;
<div>
{nextPage}
{lastPage}
</div>
);
}
const alignProp = mutuallyExclusiveTrueProps('centerAlign', 'endAlign', 'startAlign');
Pagination.propTypes = {
centerAlign: alignProp,
endAlign: alignProp,
pageCount: requiredBy('showBookends', PropTypes.number),
startAlign: alignProp,
onFirst: requiredBy('showBookends', PropTypes.func),
onLast: requiredBy('showBookends', PropTypes.func),
};
export default Pagination;
/** Add "notranslate" className to prevent Google Chrome translation. */
noTranslate?: boolean;
/** Enable proofreader to run spelling and grammar checks. */
proofread?: boolean;
/** Additional props that determine more proofreader functionality */
proofreadProps?: ExtraProofreadProps;
};
export type State = {
id: string;
};
/** A controlled textarea field. */
export default class TextArea extends React.Component {
static propTypes = {
onCheckText: requiredBy('proofread', PropTypes.func),
};
static defaultProps = {
locale: 'none',
noTranslate: false,
proofread: false,
proofreadProps: undefined,
};
state = {
id: uuid(),
};
render() {
const { fieldProps, inputProps } = partitionFieldProps(this.props);
const { locale, name, proofread, proofreadProps, onCheckText, ...textareaProps } = inputProps;
<div>
{nextPage}
{lastPage}
</div>
);
}
const alignProp = mutuallyExclusiveTrueProps('centerAlign', 'endAlign', 'startAlign');
Pagination.propTypes = {
centerAlign: alignProp,
endAlign: alignProp,
pageCount: requiredBy('showBookends', PropTypes.number),
startAlign: alignProp,
onFirst: requiredBy('showBookends', PropTypes.func),
onLast: requiredBy('showBookends', PropTypes.func),
};
export default Pagination;
{nextPage}
{lastPage}
);
}
const alignProp = mutuallyExclusiveTrueProps('centerAlign', 'endAlign', 'startAlign');
Pagination.propTypes = {
centerAlign: alignProp,
endAlign: alignProp,
pageCount: requiredBy('showBookends', PropTypes.number),
startAlign: alignProp,
onFirst: requiredBy('showBookends', PropTypes.func),
onLast: requiredBy('showBookends', PropTypes.func),
};
export default Pagination;
onClick={onIconClick}
>
{afterIcon}
) : (
afterIcon
)}
)}
);
}
Chip.propTypes = {
afterIcon: requiredBy('onIconClick', iconComponent),
beforeIcon: mutuallyExclusiveProps(PropTypes.node, 'beforeIcon', 'profileImageSrc'),
compact: mutuallyExclusiveProps(PropTypes.any, 'profileImageSrc', 'compact'),
profileImageSrc: mutuallyExclusiveProps(
PropTypes.any,
'beforeIcon',
'profileImageSrc',
'compact',
),
onClick: mutuallyExclusiveProps(PropTypes.func, 'onIconClick'),
};
export default Chip;