#15313: TileLayerOptions should not be a dictionary to make it checkable

This commit is contained in:
Arne Schubert
2018-10-31 18:51:22 +01:00
parent 549360d30e
commit 2d429c4da8
2 changed files with 5 additions and 6 deletions

View File

@@ -494,7 +494,11 @@ export interface TileLayerOptions extends GridLayerOptions {
zoomReverse?: boolean;
detectRetina?: boolean;
crossOrigin?: boolean;
[name: string]: any;
// [name: string]: any;
// You are able add additional properties, but it makes this interface unchackable.
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15313
// Example:
// tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''});
}
export class TileLayer extends GridLayer {

View File

@@ -227,9 +227,6 @@ tileLayerOptions = {
pane: '',
className: '',
keepBuffer: 1,
foo: 'bar',
bar: () => 'foo',
abc: (data: any) => 'foobar'
};
tileLayerOptions.subdomains = 'a';
@@ -245,11 +242,9 @@ tileLayerOptions.bounds = latLngBoundsLiteral;
let tileLayer: L.TileLayer;
tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions);
tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''});
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions);
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''});
// imageOverlay
let imageOverlayOptions: L.ImageOverlayOptions;