UNPKG

661 BPlain TextView Raw
1import createRematchStore from './rematchStore'
2import { InitConfig, Models, RematchStore, ModelCreator } from './types'
3import createConfig from './config'
4
5/**
6 * Prepares a complete configuration and creates a Rematch store.
7 */
8export const init = <
9 TModels extends Models<TModels>,
10 TExtraModels extends Models<TModels> = Record<string, never>
11>(
12 initConfig?: InitConfig<TModels, TExtraModels>
13): RematchStore<TModels, TExtraModels> => {
14 const config = createConfig(initConfig || {})
15 return createRematchStore(config)
16}
17
18export const createModel: ModelCreator = () => (mo) => mo as any
19
20export default {
21 init,
22 createModel,
23}
24
25export * from './types'