1 | import { warn } from './warn';
|
2 | /**
|
3 | * Warns when props are required if a condition is met.
|
4 | *
|
5 | * @public
|
6 | * @param componentName - The name of the component being used.
|
7 | * @param props - The props passed into the component.
|
8 | * @param requiredProps - The name of the props that are required when the condition is met.
|
9 | * @param conditionalPropName - The name of the prop that the condition is based on.
|
10 | * @param condition - Whether the condition is met.
|
11 | */
|
12 | export function warnConditionallyRequiredProps(componentName, props, requiredProps, conditionalPropName, condition) {
|
13 | if (condition === true && process.env.NODE_ENV !== 'production') {
|
14 | for (var _i = 0, requiredProps_1 = requiredProps; _i < requiredProps_1.length; _i++) {
|
15 | var requiredPropName = requiredProps_1[_i];
|
16 | if (!(requiredPropName in props)) {
|
17 | warn(componentName + " property '" + requiredPropName + "' is required when '" + conditionalPropName + "' is used.'");
|
18 | }
|
19 | }
|
20 | }
|
21 | }
|
22 | //# sourceMappingURL=warnConditionallyRequiredProps.js.map |
\ | No newline at end of file |