import { isValidElement } from 'react';
import { w as warnOnce } from './warnOnce-Y9PRHcU4.js';

function warnDeprecatedErrorUsage(componentName, error) {
  if (error === void 0 || typeof error === "boolean") return;
  if (typeof error === "string" || Array.isArray(error)) return;
  if (isValidElement(error)) {
    warnOnce(
      `[Anvil2 ${componentName}] Passing a ReactElement to the \`error\` prop is deprecated. Use a string or string[] instead: \`error="message"\` or \`error={["msg1", "msg2"]}\`. See https://beta.anvil.servicetitan.com/docs/web/components/field-message/code`
    );
  }
}

export { warnDeprecatedErrorUsage as w };
//# sourceMappingURL=utils-CM48ODEJ.js.map
