title: ts-jest - declare const from typing (.d.ts) values are undefined when running jest
body: <p>I'm relatively new to use Typescript and Jest and I've been running into an issue where I have a whole bunch of ambient declarations in a typings files (index.d.ts) in <code>@types/screeps</code>. These look like this:</p>
  
  <pre><code>declare const OK: 0;
  declare const ERR_NOT_OWNER: -1;
  //etc.
  </code></pre>
  
  <p>Whenever I use these constants in a test, I will get an <code>ReferenceError: OK is not defined</code> within Jest. If I do declare the value within the test the location of the error will move to the file being tested.</p>
  
  <p>I did some googling around and I found this particular bug in the ts-jest repository: <a href="https://github.com/kulshekhar/ts-jest/issues/112" rel="nofollow noreferrer">https://github.com/kulshekhar/ts-jest/issues/112</a></p>
  
  <p>However, I'm having a hard time following the discussion because I hardly ever used Typescript and really do not understand how I can solve this issue myself. What I want is to be able to declare these values in the ambient scope and use them in my tests. Whenever the code is compiled using rollup the type will get picked up(since it's an globally available value in Screeps during runtime and the compiled output is fine). I don't mind tweaking the tsconfig.json or copying files / hacking a solution together.</p>
  
  <p>I tried copying the index.d.ts from the @types folder into my test folder, tried doing an import on it, tried changing the <code>declare const</code> to <code>export const</code> (but then I need to import the module and it's all in a particular namespace). Tried doing a <code>declare global</code>, no luck either. </p>
  
  <p>It seems this behavior is intentional for reasons beyond my comprehension. I'm really confused, is there a way for me to solve this? Or am I just outta luck?</p>