question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError with put effect when use channel

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Apr 15, 2019
1reaction
bbilcommented, Aug 24, 2020

@jp928 I’ve created a Pull Request that adds the necessary variant to the index.d.ts

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found