使用有效负载调度操作会产生以下打字稿错误:
Argument of type 'string' is not assignable to parameter of type 'TakeableChannel'.
Run Code Online (Sandbox Code Playgroud)
例子:
export default function* watchAuth() {
yield* takeLatest(startAuth.toString(), handleAuthUser); // Argument of type 'string' is not assignable to parameter of type 'TakeableChannel'.
}
Run Code Online (Sandbox Code Playgroud)
使用:
"@reduxjs/toolkit": "^1.8.5",
"typed-redux-saga": "^1.5.0",
Run Code Online (Sandbox Code Playgroud)
编辑:handleAuthUser生成器函数
function* handleAuthUser({ payload: { fields, isRegister } }) {
const { email, password } = fields || {};
try {
if (isRegister) {
// User registering an account
yield* call(registerAWS, fields);
yield* put(promptConfirmation({ email, password }));
} else …Run Code Online (Sandbox Code Playgroud)