captide
Version:
Get hundreds of thousands of financial documents into your AI app 🚀
24 lines (23 loc) • 924 B
TypeScript
/**
* Custom dynamic import function that works with or without Next.js
*
* This provides a unified API for dynamic imports across different environments.
* In Next.js environments, it uses next/dynamic.
* In non-Next.js environments, it provides a simple dynamic import wrapper.
*/
import React from 'react';
interface DynamicOptions {
ssr?: boolean;
loading?: React.ComponentType<any>;
}
/**
* Dynamically import a component with options for SSR
*
* @param importFunc - A function that returns a promise for a React component
* @param options - Options for dynamic import (ssr, loading component)
* @returns A dynamically imported React component
*/
declare const dynamicImport: <P extends object>(importFunc: () => Promise<{
default: React.ComponentType<P>;
}>, options?: DynamicOptions) => React.ComponentType<P> | React.LazyExoticComponent<React.ComponentType<P>>;
export default dynamicImport;