import React from 'react';

/**
 * This function performs a soft validation to check if the provided element is a React element.
 * It returns a typed component but does not verify if the element type matches the expected T component.
 *
 * @param el - The element to be checked.
 * @returns - Returns a boolean indicating whether the element is a valid React element of type P and T.
 */
export function isValidElement<
  P,
  T extends string | React.JSXElementConstructor<any>,
>(el: any): el is React.ReactElement<P, T> {
  return React.isValidElement<P>(el);
}
