title: Redux-saga : can't access class instance inside saga?
body: <p>I am trying to inject dependencies into the top rootSaga. Seems like whenever i try to access a property of an instance, it is undefined and it can't access <code>this.myClassProp</code></p>
  <p>Why are those instance not accessible through saga ?</p>
  <h3>Declare dependency :</h3>
  <pre><code>export const dependencies: Dependencies = {
      imageFetchingGateway: new HttpImageFetchingGateway()
  }
  
  </code></pre>
  <pre><code>export const configureStore = () =&gt; createReduxStore(dependencies)
  </code></pre>
  <h3>Dependency implementation (faked)</h3>
  <pre><code>export class HttpImageFetchingGateway implements ImageFetcherGateway {
  
      private readonly pictureName: string;
  
      constructor() {
          this.pictureName = &quot;fakeHttpIamge&quot;
      }
  
      * fetch() {
          yield delay(1000);
          //yield put(image_fetched(&quot;someString&quot;));     --&gt; This will work and dispatch the correct payload
          yield put(image_fetched(this.pictureName));   --&gt; This will fail
      }
  }
  </code></pre>
  <p><strong>TypeError: Cannot read property 'pictureName' of null</strong></p>
  <h3>Create store, DI and run Saga</h3>
  <pre><code>export function createReduxStore(dependencies: Dependencies): Store&lt;AppState&gt; {
      const sagaMiddleware = createSagaMiddleware();
      let store = createStore(reducers, applyMiddleware(sagaMiddleware));
      sagaMiddleware.run(rootSaga, dependencies);
      return store;
  }
  </code></pre>
  <h3>RootSaga</h3>
  <pre><code>export default function* rootSaga(dependencies: Dependencies) {
      yield takeEvery(fetch, dependencies.imageFetchingGateway.fetch)
  }
  </code></pre>
  <h3>Summary</h3>
  <p>I can access <code>dependencies.imageFetchingGateway.fetch</code> and disptach actions and run effects inside the generator. However every attritube that is owned by the instance <code>new HttpImageFetchingGateway()</code> and accessible with <code>this</code> tells me this instance is undefined.</p>
  <p>The construtor sets <code>pictureName</code> properly</p>
  <p>I also added DI tag since the final goal here is to be able to tweak the dependencies on which saga will run</p>