title: How to create typed variables in beforeAll tests?
body: <p>There is a common scenario I run into. I need to create a variable in the <code>beforeAll</code> or each.</p>
  
  <pre><code>describe('some test', () =&gt; {
    beforeAll(() =&gt; {
      const foo = createFoo({}, {});    
    });
  
    it('returns something', () =&gt; {
      // how to access foo?
    });
  });
  </code></pre>
  
  <p>If I do it like that I can't access <code>foo</code> on <code>it</code> tests because it only exists inside <code>beforeAll</code> scope.</p>
  
  <p>To be able to access where I need I have to declare <code>foo</code> inside <code>describe</code>:</p>
  
  <pre><code>describe('', () =&gt; {
    let foo;
  </code></pre>
  
  <p>Or use</p>
  
  <pre><code>this.foo =
  </code></pre>
  
  <p>The problem with both these approaches is that I lose the type information. And I don't have explicit interfaces for the return type of those kind of functions.</p>
  
  <p>Is there a way to declare <code>foo</code> somewhere where I can access it later and not lose type information?</p>