如何正确输入传奇

问题描述 投票:2回答:2

我正在尝试输入传奇。我使用的是流式定义:https://github.com/flowtype/flow-typed/blob/master/definitions/npm/redux-saga_v0.13.x/flow_v0.36.x-v0.37.x/redux-saga_v0.13.x.js

export function* fetchUsers(): Generator<IOEffect, void, any> {
  const users = yield call(UserApi.list)
  yield put(fetchUserSucc(users))
}

但流程一直在抱怨:

标识符IOEffect无法解析名称

我究竟做错了什么?

redux flowtype redux-saga
2个回答
4
投票

您需要从libdef导入IOEffect,如下所示:

import type { IOEffect } from 'redux-saga/effects';

资料来源:https://github.com/flowtype/flow-typed/issues/645


2
投票

试试这个:

import { type Saga } from 'redux-saga';

export function* fetchUsers(): Saga<void> {
  some logic...
}

它适合我

© www.soinside.com 2019 - 2024. All rights reserved.