Merge pull request #8739 from schmidtk/ts-format-wmsgfi

Fix TypeScript errors in ol/format/WMSGetFeatureInfo
This commit is contained in:
Andreas Hocevar
2018-10-02 21:27:54 +02:00
committed by GitHub
+6 -3
View File
@@ -100,10 +100,12 @@ class WMSGetFeatureInfo extends XMLFeature {
if (layer.nodeType !== Node.ELEMENT_NODE) { if (layer.nodeType !== Node.ELEMENT_NODE) {
continue; continue;
} }
const layerElement = /** @type {Element} */ (layer);
const context = objectStack[0]; const context = objectStack[0];
const toRemove = layerIdentifier; const toRemove = layerIdentifier;
const layerName = layer.localName.replace(toRemove, ''); const layerName = layerElement.localName.replace(toRemove, '');
if (this.layers_ && !includes(this.layers_, layerName)) { if (this.layers_ && !includes(this.layers_, layerName)) {
continue; continue;
@@ -115,14 +117,15 @@ class WMSGetFeatureInfo extends XMLFeature {
context['featureType'] = featureType; context['featureType'] = featureType;
context['featureNS'] = this.featureNS_; context['featureNS'] = this.featureNS_;
/** @type {Object<string, import("../xml.js").Parser>} */
const parsers = {}; const parsers = {};
parsers[featureType] = makeArrayPusher( parsers[featureType] = makeArrayPusher(
this.gmlFormat_.readFeatureElement, this.gmlFormat_); this.gmlFormat_.readFeatureElement, this.gmlFormat_);
const parsersNS = makeStructureNS( const parsersNS = makeStructureNS(
[context['featureNS'], null], parsers); [context['featureNS'], null], parsers);
layer.setAttribute('namespaceURI', this.featureNS_); layerElement.setAttribute('namespaceURI', this.featureNS_);
const layerFeatures = pushParseAndPop( const layerFeatures = pushParseAndPop(
[], parsersNS, layer, objectStack, this.gmlFormat_); [], parsersNS, layerElement, objectStack, this.gmlFormat_);
if (layerFeatures) { if (layerFeatures) {
extend(features, layerFeatures); extend(features, layerFeatures);
} }