import { IAction, IConfiguration, Overmind } from 'overmind' import { Options } from 'overmind/lib/internalTypes' export interface Base extends IConfiguration { state: {} effects: {} actions: {} reactions: {} } export interface Using { using(b: U): Using config(): Pick app(options?: Options): Overmind } export interface UnknownObject { [key: string]: unknown } type Pass = T type UnWrap = T[keyof T] extends Pass ? U : never type UnWrapSettings = UnWrap> export interface Setup< Config extends IConfiguration = any, SettingsType = unknown, UnWrapS = UnWrapSettings > { (config: Config, settings: Settings): void } export interface Settings { [blockName: string]: T } export type Initializer = IAction export interface BaseBlock { name: string dependencies?: BaseBlock[] settings?: SettingsType onInitialize?: Initializer setup?: Setup } /** This interface should only be used when the App type for the block is fully * known (like in libraries) because it hides the actual config content. */ export type Block< Config extends IConfiguration = IConfiguration, SettingsType = any, MySettings = any > = Config & BaseBlock