title: How to specify setInterval interface while use Node.js & ES6 (electron,react)
body: <p><strong>(Environment, ubuntu 14.04, electron 1.8.3, IDE：vscode)</strong>
  I'm developing a electron app using typescript, react, the target in tsconfig.json be configured to 'es6', use webpack to package.</p>
  
  <p>Here I find a strange result when I use <code>setInterval</code>. Here is my code (the code is a section of a private function in tsx file):</p>
  
  <pre><code>let cur=0;  
  let testTimer=setInterval(()=&gt;{
      console.log(cur);
      if(cur&lt;5){
          cur++;
      }else{
          clearInterval(testTimer);
      }
  }, 1000);
  </code></pre>
  
  <p>The clearInterval(testTimer) doesn't work, the loop aways log '5'.</p>
  
  <p>I try to find the reason, and I found that here is the problem, the 'setInterval' in es6 is different of NodeJS, in es6, setInterval return a number ID, but NodeJS return a Object(NodeJS.Timer), the clearInterval use its corresponding parameter. So I guess when my code compile to js, the 'setInterval' &amp; 'clearInterval' mismatched, such the 'setInterval' use the Nodejs interface so return a Object, but 'clearInterval' use the es6 interface parameter need a number.</p>
  
  <p>I debug it in electron dev tool, my guess is right, <strong>setInterval return an Object(NodeJS.Timer).</strong></p>
  
  <p>But! this phenomenon does not always exist, I try recompile my code using another computer(similar environment, but ubuntu version is 16.04), it work normally, clearInterval(testTimer) worked.</p>
  
  <p>I also debug in dev tool, <strong>setInterval return a number, so clearInterval worked</strong>.</p>
  
  <p>Another phenomenon show as the picture below,</p>
  
  <p><a href="https://i.stack.imgur.com/8Dy2H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Dy2H.png" alt="screenshot"></a></p>
  
  <p>In PC_A（ubuntu 16.04， worked will）
  When I declare testTimer as number, the tslink warning me it should a 'Timer', but the webpack compile and package work will, and the clearInterval also work will. bu if the testTimer declared as 'Timer', the compile will failed.
  this means, in 'worked will' computer, webpack will use es6 interface.</p>
  
  <p>In PC_B(ubuntu 14.04， worked wrong)
  declare testTimer as number, compile failed!
  declare testTimer as Timer,compile success! <strong>The phenomenon is just the opposite.</strong></p>
  
  <p><strong>So, My question is as the title, how to specify setInterval interface, I want specify setInterval use the es6 interface, So, the code in different environment will work the same result.</strong> </p>