import type { ReactElement } from 'react'; import type { ArrayPath, Path, PathValue } from 'react-hook-form'; import type { RouteObject } from 'react-router'; import type { MaybePromise } from '@wener/utils'; export interface ModuleStore = Record> { set

| ArrayPath, V extends PathValue>( type: P, payload: V, options?: { merge?: boolean }, ): void; get

| ArrayPath, V extends PathValue>(path: P): V; add

| ArrayPath, V extends PathValue>( type: P, payload: V extends Array ? V | V[number] : V, ): void; collect

| ArrayPath, V extends PathValue>(path: P): V; as>(): ModuleStore; } export interface KnownDynamicModuleMetadata { id?: string; name?: string; title?: string; description?: string; version?: string; tags?: string[]; dependencies?: string[]; [key: string]: any; } export interface ModuleContext extends ModuleStore {} export interface DynamicModule { onModuleInit?: (ctx: ModuleContext) => MaybePromise; createRoutes?: (ctx: ModuleContext) => MaybePromise; element?: ReactElement; metadata?: KnownDynamicModuleMetadata; }