@umijs/plugins 4.0.0-canary.20220928.1 → 4.0.0-canary.20220929.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/dva.js +62 -0
  2. package/package.json +3 -3
package/dist/dva.js CHANGED
@@ -172,6 +172,68 @@ export { connect, useDispatch, useStore, useSelector } from 'dva';
172
172
  export { getDvaApp } from './dva';
173
173
  `
174
174
  });
175
+ api.writeTmpFile({
176
+ path: "types.d.ts",
177
+ tpl: `
178
+ import type { History } from 'umi';
179
+
180
+ export interface ConnectProps {
181
+ dispatch?: Dispatch;
182
+ }
183
+ type RequiredConnectProps = Required<ConnectProps>
184
+ export type ConnectRC<
185
+ T = {},
186
+ > = React.ForwardRefRenderFunction<any, T & RequiredConnectProps>;
187
+ interface Action<T = any> {
188
+ type: T
189
+ }
190
+ interface AnyAction extends Action {
191
+ // Allows any extra properties to be defined in an action.
192
+ [extraProps: string]: any
193
+ }
194
+ interface Dispatch<A extends Action = AnyAction> {
195
+ <T extends A>(action: T): T
196
+ }
197
+ interface EffectsCommandMap {
198
+ put: <A extends AnyAction>(action: A) => any,
199
+ call: Function,
200
+ select: Function,
201
+ take: Function,
202
+ cancel: Function,
203
+ [key: string]: any,
204
+ }
205
+ interface Action<T = any> {
206
+ type: T
207
+ }
208
+ export type Reducer<S = any, A extends Action = AnyAction> = (prevState: S, action: A) => S;
209
+ export type Effect = (action: AnyAction, effects: EffectsCommandMap) => void;
210
+ type EffectType = 'takeEvery' | 'takeLatest' | 'watcher' | 'throttle';
211
+ type EffectWithType = [Effect, { type: EffectType }];
212
+ export type Subscription = (api: SubscriptionAPI, done: Function) => void;
213
+
214
+ export interface ReducersMapObject<T> {
215
+ [key: string]: Reducer<T>,
216
+ }
217
+ export interface EffectsMapObject {
218
+ [key: string]: Effect | EffectWithType,
219
+ }
220
+ export interface SubscriptionAPI {
221
+ dispatch: Dispatch<any>,
222
+ history: History,
223
+ }
224
+ export interface SubscriptionsMapObject {
225
+ [key: string]: Subscription,
226
+ }
227
+ export interface DvaModel<T, E = EffectsMapObject, R = ReducersMapObject<T>> {
228
+ namespace: string,
229
+ state?: T,
230
+ reducers?: R,
231
+ effects?: E,
232
+ subscriptions?: SubscriptionsMapObject,
233
+ }
234
+ `,
235
+ context: {}
236
+ });
175
237
  });
176
238
  api.addTmpGenerateWatcherPaths(() => {
177
239
  return [(0, import_path.join)(api.paths.absSrcPath, "models")];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.0-canary.20220928.1",
3
+ "version": "4.0.0-canary.20220929.2",
4
4
  "description": "@umijs/plugins",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -27,7 +27,7 @@
27
27
  "@ant-design/antd-theme-variable": "^1.0.0",
28
28
  "@ant-design/icons": "^4.7.0",
29
29
  "@ant-design/pro-components": "^2.0.1",
30
- "@umijs/bundler-utils": "4.0.0-canary.20220928.1",
30
+ "@umijs/bundler-utils": "4.0.0-canary.20220929.2",
31
31
  "@umijs/valtio": "^1.0.0",
32
32
  "antd-dayjs-webpack-plugin": "^1.0.6",
33
33
  "axios": "^0.27.2",
@@ -47,7 +47,7 @@
47
47
  "warning": "^4.0.3"
48
48
  },
49
49
  "devDependencies": {
50
- "umi": "4.0.0-canary.20220928.1"
50
+ "umi": "4.0.0-canary.20220929.2"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"