umi-plugin-dva-connect
v1.0.1
Published
generate types definitions of dvajs models automatically
Downloads
2
Readme
umi-plugin-dva-connect
generate types definitions of dvajs models automatically
Install
# or yarn
$ npm install
$ npm run build --watch
$ npm run start
Usage
Configure in .umirc.js
,
export default {
plugins: [['umi-plugin-dva-connect', options]],
};
Model
with as const
const exampleModel = {
namespace: 'example',
state: {
count: 0,
},
} as const;
export default exampleModel;
with interface
interface ExampleModel = {
namespace: 'example';
state: {
count: number;
};
};
const exampleModel: ExampleModel = {
namespace: 'example',
state: {
count: 0,
},
};
export default exampleModel;
Import from plugin
import { DvaState } from 'umi-plugin-dva-connect';
Options
interface PluginDvaConnectOptions {
/**
* `dva-loading` enabled or not.
* @default
* true
*/
loading?: boolean;
/**
* name directory in singular.
* @default
* false
*/
singular?: boolean;
}
LICENSE
MIT