import React from 'react'; /** * An async wrapper around a heavy-weight React dependency * * The component should only be loaded once. */ export declare function asyncComponent(doImport: asyncComponent.IImporter, onError?: asyncComponent.IErrorHandler): asyncComponent.TImportable; /** * A namespace for relevant interfaces */ export declare namespace asyncComponent { /** * The type of thing that can be lazily loaded */ type TImportable = React.ComponentClass | React.StatelessComponent; /** * A lazy loader that uses `await import` * * Should probably also specify a webpackChunkName * https://webpack.js.org/guides/code-splitting/#dynamic-imports */ interface IImporter { (): Promise; } /** * An error handler (can't have any particular side effects */ interface IErrorHandler { (err: any): void; } /** * The state of the wrapper component. * * Apparently this can't be yet... */ interface IState { __async_component: TImportable | null; } }