import { ComponentType, LazyExoticComponent, ReactChild, ReactElement, JSXElementConstructor, FunctionComponentElement, ElementType } from 'react';

interface LazyFactory<T extends ComponentType<any>> extends LazyFactoryMeta {
    (): Promise<{
        default: T;
    }>;
}
interface LazyFactoryMeta {
    chunk?: string;
    lazyImport?: string;
    sync?: true;
}

interface LazyOptions<T> {
    fallback?: (props: T extends ComponentType<infer U> ? U : unknown) => ElementType;
}
declare function lazy<T extends ComponentType<any>>(factory: LazyFactory<T>, options: LazyOptions<T>): LazyExoticComponent<T> | (<P extends {}>(props: P, ...children: ReactChild[]) => ReactElement<{}, string | JSXElementConstructor<any>> | FunctionComponentElement<{}>);

export { lazy };
