@types/loadable__component

  • Version 5.13.9
  • Published
  • 6.29 kB
  • 1 dependency
  • MIT license

Install

npm i @types/loadable__component
yarn add @types/loadable__component
pnpm add @types/loadable__component

Overview

TypeScript definitions for @loadable/component

Index

Variables

variable loadable

const loadable: {
<Props, Module = any>(
loadFn: (props: Props) => Promise<Module>,
options: OptionsWithResolver<Props, Module>
): any;
<Props>(
loadFn: (props: Props) => Promise<any>,
options?: OptionsWithoutResolver<Props>
): any;
<Component extends React.ComponentClass<any>>(
loadFn: (
props: React.ComponentProps<Component>
) => Promise<Component | { default: Component }>,
options?: Options<React.ComponentProps<Component>, Component>
): any;
} & { lib: typeof lib };

    Functions

    function lazy

    lazy: typeof lazy;

      function lib

      lib: <Props, Module>(
      loadFn: (props: Props) => Promise<Module>,
      options?: OptionsWithoutResolver<Props>
      ) => LoadableLibrary<Module>;

        function loadableFunc

        loadableFunc: {
        <Props, Module = any>(
        loadFn: (props: Props) => Promise<Module>,
        options: OptionsWithResolver<Props, Module>
        ): LoadableComponent<Props>;
        <Props>(
        loadFn: (props: Props) => Promise<any>,
        options?: OptionsWithoutResolver<Props>
        ): any;
        <Component extends React.ComponentClass<any>>(
        loadFn: (
        props: React.ComponentProps<Component>
        ) => Promise<Component | { default: Component }>,
        options?: Options<React.ComponentProps<Component>, Component>
        ): any;
        };

          function loadableReady

          loadableReady: (
          done?: () => any,
          options?: LoadableReadyOptions
          ) => Promise<void>;

            Interfaces

            interface DefaultImportedComponent

            interface DefaultImportedComponent<Props> {}

              property default

              default: React.ComponentType<Props>;

                interface ExtraClassComponentProps

                interface ExtraClassComponentProps<Component extends React.ComponentClass>
                extends ExtraComponentProps,
                React.RefAttributes<InstanceType<Component>> {}

                  interface ExtraComponentProps

                  interface ExtraComponentProps {}

                    property fallback

                    fallback?: React.JSX.Element | undefined;

                      interface LoadableComponentMethods

                      interface LoadableComponentMethods<Props> {}

                        method load

                        load: (props?: Props) => Promise<React.ComponentType<Props>>;

                          method preload

                          preload: (props?: Props) => void;

                            interface LoadableReadyOptions

                            interface LoadableReadyOptions {}

                              property namespace

                              namespace?: string | undefined;

                                interface Options

                                interface Options<Props, Module = DefaultComponent<Props>>
                                extends OptionsWithoutResolver<Props> {}

                                  property resolveComponent

                                  resolveComponent?: ComponentResolver<Props, Module> | undefined;

                                    interface OptionsWithoutResolver

                                    interface OptionsWithoutResolver<Props> {}

                                      property fallback

                                      fallback?: React.JSX.Element | undefined;

                                        property ssr

                                        ssr?: boolean | undefined;

                                          method cacheKey

                                          cacheKey: (props: Props) => any;

                                            interface OptionsWithResolver

                                            interface OptionsWithResolver<Props, Module = DefaultComponent<Props>>
                                            extends OptionsWithoutResolver<Props> {}

                                              property resolveComponent

                                              resolveComponent: ComponentResolver<Props, Module>;

                                                Type Aliases

                                                type ComponentResolver

                                                type ComponentResolver<Props, Module = DefaultComponent<Props>> = (
                                                module: Module,
                                                props: Props
                                                ) => React.ComponentType<Props>;
                                                • Synchronous function that returns the component from the imported module.

                                                  The default works with default exports, both CommonJS or ESM

                                                type DefaultComponent

                                                type DefaultComponent<Props> =
                                                | React.ComponentType<Props>
                                                | DefaultImportedComponent<Props>;

                                                  type LoadableClassComponent

                                                  type LoadableClassComponent<Component extends React.ComponentClass> =
                                                  React.ComponentType<
                                                  React.ComponentProps<Component> & ExtraClassComponentProps<Component>
                                                  > &
                                                  LoadableComponentMethods<React.ComponentProps<Component>>;

                                                    type LoadableComponent

                                                    type LoadableComponent<Props> = React.ComponentType<Props & ExtraComponentProps> &
                                                    LoadableComponentMethods<Props>;

                                                      type LoadableLibrary

                                                      type LoadableLibrary<Module> = React.ComponentType<{
                                                      fallback?: React.JSX.Element | undefined;
                                                      children?: ((module: Module) => React.ReactNode) | undefined;
                                                      ref?: React.Ref<Module> | undefined;
                                                      }> &
                                                      Module &
                                                      LoadableComponentMethods<object>;

                                                        Namespaces

                                                        namespace lazy

                                                        namespace lazy {}

                                                          function lib

                                                          lib: <Module>(
                                                          loadFn: (props: object) => Promise<Module>
                                                          ) => LoadableLibrary<Module>;

                                                            Package Files (1)

                                                            Dependencies (1)

                                                            Dev Dependencies (0)

                                                            No dev dependencies.

                                                            Peer Dependencies (0)

                                                            No peer dependencies.

                                                            Badge

                                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/loadable__component.

                                                            • Markdown
                                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/loadable__component)
                                                            • HTML
                                                              <a href="https://www.jsdocs.io/package/@types/loadable__component"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>