import { RootState as BaseState } from "react-coat" ; import { ModuleNames } from "./names" ; export const moduleGetter = ( < T extends { [ moduleName in ModuleNames ] : ( ) => any ; } > ( getter ) => { return getter as { [ key in ModuleNames ] : T [ key ] ; } ; } ) ( { app : ( ) => { return import ( "modules/app" ) ; } , photos : ( ) => { return import ( "modules/photos" ) ; } , videos : ( ) => { return import ( "modules/videos" ) ; } , messages : ( ) => { return import ( "modules/messages" ) ; } , comments : ( ) => { return import ( "modules/comments" ) ; } , } ) ; export type ModuleGetter = typeof moduleGetter ; export type RootState = BaseState < ModuleGetter > ;