import { channel , buffers } from "redux-saga" ; import * as Effects from "typed-redux-saga" ; function * mySaga ( ) { yield * Effects . take ( "FOO" ) ; type FooAction = { readonly type : "FOO" ; } ; yield * Effects . take < FooAction > ( "FOO" ) ; yield * Effects . takeMaybe ( "FOO" ) ; yield * Effects . takeMaybe < FooAction > ( "FOO" ) ; const chan = channel < "FOO" > ( ) ; yield * Effects . take ( chan ) ; yield * Effects . takeMaybe ( chan ) ; yield * Effects . takeEvery ( "FOO" , function * ( ) { } ) ; yield * Effects . takeEvery ( chan , function * ( ) { } ) ; yield * Effects . takeLatest ( "FOO" , function * ( ) { } ) ; yield * Effects . takeLatest ( chan , function * ( ) { } ) ; yield * Effects . takeLeading ( "FOO" , function * ( ) { } ) ; yield * Effects . takeLeading ( chan , function * ( ) { } ) ; yield * Effects . put ( { type : "FOO" } ) ; yield * Effects . put ( chan , "FOO" ) ; yield * Effects . putResolve ( { type : "FOO" } ) ; yield * Effects . call ( function ( ) : number { return 22 ; } ) ; yield * Effects . call ( ( ) => 22 ) ; yield * Effects . call ( function ( ) : Promise < number > { return Promise . resolve ( 22 ) ; } ) ; yield * Effects . call ( function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) ; function someApiCall ( ) { return 1 ; } function someSelect ( ) { return 1 ; } function * doStuff ( ) { yield * Effects . call ( someApiCall ) ; yield * Effects . select ( someSelect ) ; } const person = { firstName : "John" , lastName : "Doe" , id : 5566 , fullName ( ) { return `${ this . firstName } ${ this . lastName }` ; } , } ; yield * Effects . apply ( person , "fullName" , [ ] ) ; yield * Effects . cps ( ( ) : number => 22 ) ; let task = yield * Effects . fork ( function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) ; task = yield * Effects . spawn ( function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) ; yield * Effects . join ( task ) ; yield * Effects . cancel ( task ) ; yield * Effects . select ( ( state ) : number => state . foo ) ; yield * Effects . actionChannel ( "FOO" ) ; yield * Effects . actionChannel < FooAction > ( "FOO" ) ; const fooChan = yield * Effects . actionChannel < FooAction > ( "FOO" , buffers . sliding < FooAction > ( 5 ) ) ; yield * Effects . take ( fooChan ) ; yield * Effects . flush ( chan ) ; yield * Effects . cancelled ( ) ; yield * Effects . setContext ( { foo : "bar" } ) ; yield * Effects . getContext < string > ( "foo" ) ; yield * Effects . delay ( 120 ) ; yield * Effects . delay ( 120 , true ) ; yield * Effects . throttle ( 25 , "FOO" , function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) ; yield * Effects . debounce ( 25 , "FOO" , function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) ; yield * Effects . retry ( 5 , 100 , function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) ; yield * Effects . all ( [ Effects . call ( function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) , Effects . call ( function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) , ] ) ; yield * Effects . all ( { foo : Effects . call ( function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) , bar : Effects . call ( function * ( ) : Effects . SagaGenerator < string > { yield * Effects . take ( chan ) ; return "hello" ; } ) , } ) ; yield * Effects . race ( [ Effects . call ( function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) , Effects . call ( function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) , ] ) ; yield * Effects . race ( { foo : Effects . call ( function * ( ) : Effects . SagaGenerator < number > { yield * Effects . take ( chan ) ; return 22 ; } ) , bar : Effects . call ( function * ( ) : Effects . SagaGenerator < string > { yield * Effects . take ( chan ) ; return "hello" ; } ) , } ) ; }