clutz icon indicating copy to clipboard operation
clutz copied to clipboard

Duplicate definitions when externs file contains nested object literals

Open lambertjamesd opened this issue 10 years ago • 0 comments

When given an extern file with the content

var a = {
    b : {
        Duplicated:function() {}
    },
    NotDuplicated:function() {}
};

It outputs the following

declare namespace ಠ_ಠ.clutz.a {
  function NotDuplicated ( ) : any ;
}
declare namespace ಠ_ಠ.clutz.a.b {
  function Duplicated ( ) : any ;
}
declare namespace ಠ_ಠ.clutz.a.b {
  function Duplicated ( ) : any ;
}

The obvious workaround is to declare the externs like this but I figured I would report the issue anyway

var a = {};
a.b.Duplicated = function() {};
a.NotDuplicated = function() {};

lambertjamesd avatar Jun 29 '16 18:06 lambertjamesd