import * as React from "react"; export {}; export interface HandleClickOutside { handleClickOutside: React.MouseEventHandler; } export interface ConfigObject { handleClickOutside?: HandleClickOutside["handleClickOutside"] | undefined; excludeScrollbar?: boolean | undefined; } export interface InjectedOnClickOutProps { disableOnClickOutside(): void; enableOnClickOutside(): void; } export type WithoutInjectedClickOutProps

= Pick>; export interface AdditionalProps extends ConfigObject { disableOnClickOutside?: boolean | undefined; eventTypes?: string | string[] | undefined; outsideClickIgnoreClass?: string | undefined; preventDefault?: boolean | undefined; stopPropagation?: boolean | undefined; } export type ComponentConstructor

= React.ComponentType

; export interface ClickOutComponentClass

extends React.ComponentClass

{ new(props: P, context?: any): React.Component & HandleClickOutside; } export type OnClickOutProps

= WithoutInjectedClickOutProps

& AdditionalProps; export interface WrapperClass { new(): WrapperInstance; } export interface WrapperInstance extends React.Component>> { getInstance(): C extends React.ComponentClass ? InstanceType : never; } type PropsOf = T extends ( props: infer P, context?: any, ) => React.ReactElement | null // Try to infer for SFCs ? P : T extends new(props: infer P, context?: any) => React.Component // Otherwise try to infer for classes ? P : never; export default function OnClickOut< C extends ComponentConstructor

| ClickOutComponentClass

, P = PropsOf, >(component: C, config?: ConfigObject): WrapperClass;