Skip to content

Commit 0ea1413

Browse files
committed
Drop type casts related to L.DomUtil.create
DefinitelyTyped/DefinitelyTyped#53761
1 parent e92025d commit 0ea1413

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/control.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ export class GeocoderControl extends EventedControl {
168168
*/
169169
onAdd(map: L.Map) {
170170
const className = 'leaflet-control-geocoder';
171-
const container = L.DomUtil.create('div', className + ' leaflet-bar') as HTMLDivElement;
172-
const icon = L.DomUtil.create('button', className + '-icon', container) as HTMLButtonElement;
173-
const form = L.DomUtil.create('div', className + '-form', container) as HTMLDivElement;
171+
const container = L.DomUtil.create('div', className + ' leaflet-bar');
172+
const icon = L.DomUtil.create('button', className + '-icon', container);
173+
const form = L.DomUtil.create('div', className + '-form', container);
174174

175175
this._map = map;
176176
this._container = container;
@@ -179,24 +179,20 @@ export class GeocoderControl extends EventedControl {
179179
icon.type = 'button';
180180
icon.setAttribute('aria-label', this.options.iconLabel);
181181

182-
const input = (this._input = L.DomUtil.create('input', '', form) as HTMLInputElement);
182+
const input = (this._input = L.DomUtil.create('input', '', form));
183183
input.type = 'search';
184184
input.value = this.options.query;
185185
input.placeholder = this.options.placeholder;
186186
L.DomEvent.disableClickPropagation(input);
187187

188-
this._errorElement = L.DomUtil.create(
189-
'div',
190-
className + '-form-no-error',
191-
container
192-
) as HTMLDivElement;
188+
this._errorElement = L.DomUtil.create('div', className + '-form-no-error', container);
193189
this._errorElement.innerHTML = this.options.errorMessage;
194190

195191
this._alts = L.DomUtil.create(
196192
'ul',
197193
className + '-alternatives leaflet-control-geocoder-alternatives-minimized',
198194
container
199-
) as HTMLUListElement;
195+
);
200196
L.DomEvent.disableClickPropagation(this._alts);
201197

202198
L.DomEvent.addListener(input, 'keydown', this._keydown, this);
@@ -368,10 +364,7 @@ export class GeocoderControl extends EventedControl {
368364
private _createAlt(result: GeocodingResult, index: number) {
369365
const li = L.DomUtil.create('li', ''),
370366
a = L.DomUtil.create('a', '', li),
371-
icon =
372-
this.options.showResultIcons && result.icon
373-
? (L.DomUtil.create('img', '', a) as HTMLImageElement)
374-
: null,
367+
icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null,
375368
text = result.html ? undefined : document.createTextNode(result.name),
376369
mouseDownHandler = (e: Event) => {
377370
// In some browsers, a click will fire on the map if the control is

0 commit comments

Comments
 (0)