TypeError with put effect when use channel
See original GitHub issueI’m using channel and this is a snippet of my code:
function* handleHttpRequestAction(action: ReturnType<typeof HttpRequestActions.request>) {
const { payload: [url, options] } = action;
const chan = options.channel;
try {
const result = yield call(HttpClient, url, options);
if (chan) {
yield put(chan, HttpRequestActions.success(result));
} else {
console.warn('Unhandled HttpRequestSuccessAction:', result, { url, options });
}
// ...
and I wrote test code. but I faced typing error.
return expectSaga(HttpRequestSaga)
.dispatch(action)
.call(HttpClient, url, httpClientOptions)
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.put(chan, HttpRequestActions.success(result))
.silentRun();
Error:(38, 16) TS2554: Expected 1 arguments, but got 2.
currently, I’m use this with ts-ignore. it works.
// @ts-ignore
return expectSaga(HttpRequestSaga)
.dispatch(action)
.call(HttpClient, url, httpClientOptions)
.put(chan, HttpRequestActions.success(result))
.silentRun();
thanks for your works. I felt good saga test experience with this library.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Why am I getting: TypeError: channel.updateOverwrite is not a ...
It seems you're using discord.js v13 and trying some old code. In v13 the channel#updateOverwrite() method is removed and while in previous ...
Read more >Error Messages · GitBook - Redux Saga Test Plan
If the yielded effect and asserted effect are different types of effects, then the saga will throw an error with a message showing...
Read more >M 2.4.4: Error 'TypeError: $(...).filter(...).collapse is not ... - GitHub
It's getting annoying not being able to save pages (like settings) or needing a reload to get them to actually load/show. This error...
Read more >"expected a string enum" error when attempting to add text strip
Since effect_strip_add doesn't have any function signature that takes a string as first arguments you're getting the TypeError exception.
Read more >Trio's core functionality — Trio 0.21.0+dev documentation
If you want to use Trio, then the first thing you have to do is call trio.run() : ... This has the same...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jp928 the issue here is not with
call
but withput
effect: https://github.com/jfairbank/redux-saga-test-plan/blob/master/effects.d.ts#L17 https://github.com/redux-saga/redux-saga/blob/master/packages/core/src/internal/io.js#L52put
for channels takes 2 arguments: channel and action.@jp928 I’ve created a Pull Request that adds the necessary variant to the
index.d.ts