javascript-externs-generator icon indicating copy to clipboard operation
javascript-externs-generator copied to clipboard

Test Closure Compiler behavior with different extern fomats

Open jmmk opened this issue 8 years ago • 4 comments

Looking at the externs contained in https://github.com/google/closure-compiler/tree/master/contrib/externs, it seems like only the top-level namespace and the prototypes are defined. Is it actually necessary to recurse into everything?

e.g.

var namespace = {
    property: {
        anotherProperty: 1234
    }
};

If we use namespace.property.anotherProperty inside a program, do we need to provide externs for namespace.property.anotherProperty, or does namespace.property suffice?

jmmk avatar Jul 02 '16 14:07 jmmk

https://github.com/google/closure-compiler/blob/master/contrib/externs/maps/google_maps_api_v3.js also includes enum properties. Is this necessary or is it an optimization? If an optimization, what does it do/allow?

jmmk avatar Jul 02 '16 14:07 jmmk

Ideas for how to test this issue (#22) and others related to Closure Compiler behavior (#10, #9, #1):

jmmk avatar Jul 30 '16 22:07 jmmk

Things to test:

  • Are nested properties necessary
  • Do we need to define the prototype, or can we just specify properties of an object
  • Do we even have to make the distinction between a function and an object

jmmk avatar Apr 09 '17 00:04 jmmk

Probably easier to run on the command line: closure-compiler --compilation_level ADVANCED [--externs externs.js,] --js file.js[,] [--js_output_file output.js]

jmmk avatar Nov 11 '18 18:11 jmmk