clutz icon indicating copy to clipboard operation
clutz copied to clipboard

Objects of private type that are also namespaces emit invalid .d.ts

Open rkirov opened this issue 9 years ago • 0 comments

d3 uses the following pattern in their externs:

/**
 * @suppress {duplicate}
 */
var d3 = {};

/**
 * @typedef {function(...?)}
 */
d3.Arc;

/**
 * @private {!d3.Arc}
 */
d3.Arc_;

/**
 * @param {...?} var_args
 * @return {!Array<number>}
 */
d3.Arc_.centroid = function(var_args) {};

clutz emits an overlapping namespace and a var declaration:

declare namespace ಠ_ಠ.clutz.d3 {
  var Arc_ : ಠ_ಠ.clutz.PrivateType;
}
declare namespace ಠ_ಠ.clutz.d3.Arc_ {
  function centroid ( ...var_args : any [] ) : number [] ;
}

Most likely we should skip the var Arc_ emit, but not sure if that would be easy to detect locally.

rkirov avatar Sep 13 '17 23:09 rkirov