prodo-dev / prodo

Prodo is a React framework to build apps faster.
https://docs.prodo.dev
MIT License
115 stars 5 forks source link

Devtools: Type of state is any #129

Closed coffee-cup closed 4 years ago

coffee-cup commented 4 years ago

After adding the devtools as a plugin to my project, the type of State is any.

If I have

export const model = createModel<State>();
export const { state } = model.ctx;

the type of state is State.

However, if I then have

export const model = createModel<State>().with(devtoolsPlugin);
export const { state } = model.ctx;

the type of state is any.

I assume this is because the devtools plugin is defined as

const plugin = createPlugin<
  DevToolsConfig,
  DevToolsUniverse,
  { state: any },
  {}
>("devtools");

where the ActionCtx type is any. This any for state is being merged with the user defined State type.