Outlook_Addin_LLM/node_modules/@fluentui/utilities/lib-commonjs/warn/warnConditionallyRequiredProps.js

26 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.warnConditionallyRequiredProps = void 0;
var warn_1 = require("./warn");
/**
* Warns when props are required if a condition is met.
*
* @public
* @param componentName - The name of the component being used.
* @param props - The props passed into the component.
* @param requiredProps - The name of the props that are required when the condition is met.
* @param conditionalPropName - The name of the prop that the condition is based on.
* @param condition - Whether the condition is met.
*/
function warnConditionallyRequiredProps(componentName, props, requiredProps, conditionalPropName, condition) {
if (condition === true && process.env.NODE_ENV !== 'production') {
for (var _i = 0, requiredProps_1 = requiredProps; _i < requiredProps_1.length; _i++) {
var requiredPropName = requiredProps_1[_i];
if (!(requiredPropName in props)) {
(0, warn_1.warn)("".concat(componentName, " property '").concat(requiredPropName, "' is required when '").concat(conditionalPropName, "' is used.'"));
}
}
}
}
exports.warnConditionallyRequiredProps = warnConditionallyRequiredProps;
//# sourceMappingURL=warnConditionallyRequiredProps.js.map