Handle interfaces in the generate-externs task
Merge pull request #2643 from ahocevar/interface-externs

Handle interfaces in the generate-externs task
Map and LayerGroup layer collection as a reference.

Ensures:
- getLayers() always returns defined and non-null result;
- getLayers() always returns the same object.

Solves:
- cumbersome undefined / null checks in caller code;
- unhandled cases like in Map.addLayer();
- using an obsolete layer collection reference after a setLayers(myNewLayers)
Ex:
  - bindto(someLayers, map.getLayers()) having no more effects;
  - var sync = new Synchronizer(map.getLayers(), ...); sync.syncLayers().