Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I tried compiling the goog.net.XhrIo as a test:</p> <pre><code>goog.require('goog.Uri.QueryData'); goog.require('goog.debug.ErrorHandler'); goog.require('goog.net.XhrIo'); goog.net.XhrIo; </code></pre> <p>when I compile this I have this result:</p> <pre><code>20-nov-2010 1:12:21 com.google.javascript.jscomp.LoggerErrorManager printSummary WARNING: 0 error(s), 1 warning(s), 91,5% typed JSC_USELESS_CODE. Suspicious code. This code lacks side-effects. Is there a bug? at test.js line 5 : 0 </code></pre> <p>It seems as if the closure library itself is not 100% typed and I don't think the goal is to reach 100%. Javascript is not a statically typed language. Closure tries to bring some benefits of statically typed languages into javascript. Which is good. But that doesn't mean you have to bring in the burdens of this type of languages. </p> <h2>EDIT:</h2> <p>I tried to compile an empty file and the result was 90.4%. I think this means that the base.js with all the primitive functions is not 100% typed. So I did some more experimenting and Found out that when I also put type information on all my local variables, the percentage goes up. I don't think it is necessary to put type information on all your local variables. I mean imagine this:</p> <pre><code>/** @type {number} */ var i = 0; for(i = 0; i &lt; 10; i++) { // do something } </code></pre> <p>This can't be the goal of compiling with the closure compiler. This is proven by the fact that compiling base.js doesn't result in 100%. I try to keep this number between 85% and 95% in my development. Depending on your time, programming style and the application you're working on this can vary off course. The best guideline is to try to keep the percentage constant throughout the development of your application, whether it's 60% or 90%. Just do as much typing as needed to keep you comfortable with your own code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload