@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
12 lines (11 loc) • 573 B
TypeScript
import { Validator, Requireable } from 'prop-types';
/**
* Custom prop validator that makes a prop required if another prop is truthy.
*
* @param {string} name - The name of the prop that must exist to validate
* the current prop.
* @param {Validator} propType - The original prop type checker.
* @returns {Validator} The new prop type checker for the current prop that
* becomes required if the prop corresponding to the provided prop name exists.
*/
export default function requiredIfGivenPropIsTruthyV2(name: string, propType: Requireable<any>): Validator<any>;