title: Annotating instance properties which are set by constructor parameters?
body: <p>When using the google closure compiler, is it necessary to annotate properties that are set by constructor parameters?  e.g.</p>
  
  <pre><code>/**
   * @constructor
   * @param {string} bar
   * @param {number} barPrivate
   */
  var Foo = function(bar, barPrivate) {
    this.bar = bar;
    this.barPrivate_ = barPrivate;
  };
  </code></pre>
  
  <p>If I write this, is the compiler smart enough to figure out that:</p>
  
  <ol>
  <li>the <code>bar</code> property has type <code>{string}</code>?</li>
  <li>the <code>barPrivate</code> property has type <code>{number}</code>?</li>
  <li>the <code>barPrivate</code> property is <code>@private</code>?</li>
  </ol>
  
  <p>Or do I need to be more explicit?</p>
  
  <pre><code>/**
   * @constructor
   * @param {string} bar
   * @param {number} barPrivate
   */
  var Foo = function(bar, barPrivate) {
    /** @type {string} */
    this.bar = bar;
    /** @private {number} */
    this.barPrivate_ = barPrivate;
  };
  </code></pre>
  
  <p>The latter form seems to be less "DRY", but it's what we've been using  to be on the safe side.  I haven't found any documentation on this either way...</p>
  
  <p>After doing some minimal exploration the <a href="http://closure-compiler-debugger.appspot.com/#input0%3D%252F**%250A%2520*%2520%2540constructor%250A%2520*%2520%2540param%2520%257Bstring%257D%2520bar%250A%2520*%2520%2540param%2520%257Bnumber%257D%2520barPrivate%250A%2520*%252F%250Avar%2520Foo%2520%253D%2520function(bar%252C%2520barPrivate)%2520%257B%250A%2520%2520%252F**%2520%2540public%2520*%252F%250A%2520%2520this.bar%2520%253D%2520bar%253B%250A%2520%2520%252F**%2520%2540private%2520*%252F%250A%2520%2520this.barPrivate_%2520%253D%2520barPrivate%253B%250A%257D%26input1%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26CHECK_VISIBILITY%3D1%26CLOSURE_PASS%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1" rel="nofollow">AST with visibility declarations (but no type declarations)</a>
  is the same as the 
  <a href="http://closure-compiler-debugger.appspot.com/#input0%3D%252F**%250A%2520*%2520%2540constructor%250A%2520*%2520%2540param%2520%257Bstring%257D%2520bar%250A%2520*%2520%2540param%2520%257Bnumber%257D%2520barPrivate%250A%2520*%252F%250Avar%2520Foo%2520%253D%2520function(bar%252C%2520barPrivate)%2520%257B%250A%2520%2520%252F**%2520%2540type%2520%257Bstring%257D%2520*%252F%250A%2520%2520this.bar%2520%253D%2520bar%253B%250A%2520%2520%252F**%2520%2540private%2520%257Bnumber%257D%2520*%252F%250A%2520%2520this.barPrivate_%2520%253D%2520barPrivate%253B%250A%257D%253B%250A%26input1%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26CHECK_VISIBILITY%3D1%26CLOSURE_PASS%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1" rel="nofollow">AST when type declarations are included</a>... To me this means that visibility declarations are probably necessary but type declarations aren't?</p>