Skip to content

Commit

Permalink
refactor(tsconfig): activate strict templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-eychenne committed Mar 26, 2024
1 parent 85c98dd commit 2790be0
Show file tree
Hide file tree
Showing 96 changed files with 234 additions and 243 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@angular/compiler-cli": "^14.3.0",
"@angular/language-service": "^14.3.0",
"@types/arcgis-rest-api": "^10.4.5",
"@types/hammerjs": "^2.0.41",
"@types/jasmine": "~4.3.1",
"@types/node": "^12.11.1",
"@types/topojson-specification": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-openlayers/src/lib/attribution.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class AttributionComponent implements OnInit {

constructor(private elementRef: ElementRef) {}

ngOnInit() {
ngOnInit(): void {
this.html = this.elementRef.nativeElement.innerHTML;
this.instance = new Attribution();
}
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-openlayers/src/lib/attributions.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class AttributionsComponent implements AfterViewInit {
constructor(@Host() private source: SourceComponent) {}

/* we can do this at the very end */
ngAfterViewInit() {
ngAfterViewInit(): void {
if (this.attributions.length) {
this.instance = this.attributions.map((cmp) => cmp.html);
// console.log('setting attributions:', this.instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ export class CollectionCoordinatesComponent implements OnChanges, OnInit {
}
}

ngOnInit() {
ngOnInit(): void {
this.map.instance.on('change:view', (e) => this.onMapViewChanged(e));
this.mapSrid = this.map.instance.getView().getProjection().getCode();
this.transformCoordinates();
}

ngOnChanges(changes: SimpleChanges) {
ngOnChanges(changes: SimpleChanges): void {
this.transformCoordinates();
}

private onMapViewChanged(event) {
private onMapViewChanged(event): void {
this.mapSrid = event.target.get(event.key).getProjection().getCode();
this.transformCoordinates();
}

private transformCoordinates() {
private transformCoordinates(): void {
let transformedCoordinates: Coordinate[] | Coordinate[][] | Coordinate[][][];

if (this.srid === this.mapSrid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export class ControlAttributionComponent implements OnInit, OnDestroy {

constructor(private map: MapComponent, private element: ElementRef) {}

ngOnInit() {
ngOnInit(): void {
this.target = this.element.nativeElement;
// console.log('ol.control.Attribution init: ', this);
this.instance = new Attribution(this);
this.map.instance.addControl(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
// console.log('removing aol-control-attribution');
this.map.instance.removeControl(this.instance);
}
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-openlayers/src/lib/controls/control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export class ControlComponent implements OnInit, OnDestroy {

constructor(private map: MapComponent) {}

ngOnInit() {
ngOnInit(): void {
if (this.content) {
this.element = this.content.elementRef.nativeElement;
this.instance = new Control(this);
this.map.instance.addControl(this.instance);
}
}

ngOnDestroy() {
ngOnDestroy(): void {
if (this.instance) {
this.map.instance.removeControl(this.instance);
}
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-openlayers/src/lib/controls/default.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export class DefaultControlComponent implements OnInit, OnDestroy {

constructor(private map: MapComponent) {}

ngOnInit() {
ngOnInit(): void {
// console.log('ol.control.defaults init: ', this);
this.instance = defaults(this);
this.instance.forEach((c) => this.map.instance.addControl(c));
}

ngOnDestroy() {
ngOnDestroy(): void {
// console.log('removing aol-control-defaults');
this.instance.forEach((c) => this.map.instance.removeControl(c));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export class ControlFullScreenComponent implements OnInit, OnDestroy {
// console.log('instancing aol-control-fullscreen');
}

ngOnInit() {
ngOnInit(): void {
this.instance = new FullScreen(this);
this.map.instance.addControl(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
// console.log('removing aol-control-fullscreen');
this.map.instance.removeControl(this.instance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export class ControlMousePositionComponent implements OnInit, OnDestroy {

constructor(private map: MapComponent, private element: ElementRef) {}

ngOnInit() {
ngOnInit(): void {
this.target = this.element.nativeElement;
// console.log('ol.control.MousePosition init: ', this);
this.instance = new MousePosition(this);
this.map.instance.addControl(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
// console.log('removing aol-control-mouseposition');
this.map.instance.removeControl(this.instance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ export class ControlOverviewMapComponent implements OnInit, OnChanges, OnDestroy

constructor(private map: MapComponent) {}

ngOnInit() {
ngOnInit(): void {
this.instance = new OverviewMap(this);
this.map.instance.addControl(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
this.map.instance.removeControl(this.instance);
}

ngOnChanges(changes: SimpleChanges) {
ngOnChanges(changes: SimpleChanges): void {
if (this.instance != null && changes.hasOwnProperty('view')) {
this.reloadInstance();
}
}

private reloadInstance() {
private reloadInstance(): void {
this.map.instance.removeControl(this.instance);
this.instance = new OverviewMap(this);
this.map.instance.addControl(this.instance);
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-openlayers/src/lib/controls/rotate.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export class ControlRotateComponent implements OnInit, OnDestroy {
// console.log('instancing aol-control-rotate');
}

ngOnInit() {
ngOnInit(): void {
this.instance = new Rotate(this);
this.map.instance.addControl(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
// console.log('removing aol-control-rotate');
this.map.instance.removeControl(this.instance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export class ControlScaleLineComponent implements OnInit, OnDestroy {
// console.log('instancing aol-control-scaleline');
}

ngOnInit() {
ngOnInit(): void {
this.instance = new ScaleLine(this);
this.map.instance.addControl(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
// console.log('removing aol-control-scaleline');
this.map.instance.removeControl(this.instance);
}
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-openlayers/src/lib/controls/zoom.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export class ControlZoomComponent implements OnInit, OnDestroy {
// console.log('instancing aol-control-zoom');
}

ngOnInit() {
ngOnInit(): void {
this.instance = new Zoom(this);
this.map.instance.addControl(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
// console.log('removing aol-control-zoom');
this.map.instance.removeControl(this.instance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export class ControlZoomSliderComponent implements OnInit, OnDestroy {
// console.log('instancing aol-control-zoomslider');
}

ngOnInit() {
ngOnInit(): void {
this.instance = new ZoomSlider(this);
this.map.instance.addControl(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
// console.log('removing aol-control-zoomslider');
this.map.instance.removeControl(this.instance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export class ControlZoomToExtentComponent implements OnInit, OnDestroy {
// console.log('instancing aol-control-zoomtoextent');
}

ngOnInit() {
ngOnInit(): void {
this.instance = new ZoomToExtent(this);
this.map.instance.addControl(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
// console.log('removing aol-control-zoomtoextent');
this.map.instance.removeControl(this.instance);
}
Expand Down
8 changes: 4 additions & 4 deletions projects/ngx-openlayers/src/lib/coordinate.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ export class CoordinateComponent implements OnChanges, OnInit {
}
}

ngOnInit() {
ngOnInit(): void {
this.map.instance.on('change:view', (e) => this.onMapViewChanged(e));
this.mapSrid = this.map.instance.getView().getProjection().getCode();
this.transformCoordinates();
}

ngOnChanges(changes: SimpleChanges) {
ngOnChanges(changes: SimpleChanges): void {
this.transformCoordinates();
}

private onMapViewChanged(event) {
private onMapViewChanged(event): void {
this.mapSrid = event.target.get(event.key).getProjection().getCode();
this.transformCoordinates();
}

private transformCoordinates() {
private transformCoordinates(): void {
let transformedCoordinates: number[];

if (this.srid === this.mapSrid) {
Expand Down
6 changes: 3 additions & 3 deletions projects/ngx-openlayers/src/lib/feature.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ export class FeatureComponent implements OnInit, OnDestroy, OnChanges {

constructor(private host: SourceVectorComponent) {}

ngOnInit() {
ngOnInit(): void {
this.instance = new Feature();
if (this.id !== undefined) {
this.instance.setId(this.id);
}
this.host.instance.addFeature(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
this.host.instance.removeFeature(this.instance);
}

ngOnChanges(changes: SimpleChanges) {
ngOnChanges(changes: SimpleChanges): void {
if (this.instance) {
this.instance.setId(this.id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class GeometryLinestringComponent extends SimpleGeometryComponent impleme
super(map, host);
}

ngOnInit() {
ngOnInit(): void {
this.instance = new LineString([
[0, 0],
[1, 1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class GeometryMultiLinestringComponent extends SimpleGeometryComponent im
super(map, host);
}

ngOnInit() {
ngOnInit(): void {
this.instance = new MultiLineString([
[
[0, 0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class GeometryMultiPointComponent extends SimpleGeometryComponent impleme
super(map, host);
}

ngOnInit() {
ngOnInit(): void {
this.instance = new MultiPoint([
[0, 0],
[1, 1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class GeometryMultiPolygonComponent extends SimpleGeometryComponent imple
super(map, host);
}

ngOnInit() {
ngOnInit(): void {
this.instance = new MultiPolygon([
[
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class GeometryPointComponent extends SimpleGeometryComponent implements O
super(map, host);
}

ngOnInit() {
ngOnInit(): void {
this.instance = new Point([0, 0]);
super.ngOnInit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class GeometryPolygonComponent extends SimpleGeometryComponent implements
super(map, host);
}

ngOnInit() {
ngOnInit(): void {
this.instance = new Polygon([
[
[0, 0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export abstract class SimpleGeometryComponent implements OnInit {

constructor(protected map: MapComponent, protected host: FeatureComponent) {}

ngOnInit() {
ngOnInit(): void {
this.host.instance.setGeometry(this.instance);
}
}
2 changes: 1 addition & 1 deletion projects/ngx-openlayers/src/lib/graticule.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class GraticuleComponent implements AfterContentInit, OnChanges, OnDestro

constructor(private map: MapComponent) {}

ngOnChanges(changes: SimpleChanges) {
ngOnChanges(changes: SimpleChanges): void {
const properties: { [index: string]: any } = {};

if (!this.instance) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export class DefaultInteractionComponent implements OnInit, OnDestroy {

constructor(private map: MapComponent) {}

ngOnInit() {
ngOnInit(): void {
this.instance = defaults();
this.instance.forEach((i) => this.map.instance.addInteraction(i));
}

ngOnDestroy() {
ngOnDestroy(): void {
this.instance.forEach((i) => this.map.instance.removeInteraction(i));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export class DoubleClickZoomInteractionComponent implements OnInit, OnDestroy {

constructor(private map: MapComponent) {}

ngOnInit() {
ngOnInit(): void {
this.instance = new DoubleClickZoom(this);
this.map.instance.addInteraction(this.instance);
}

ngOnDestroy() {
ngOnDestroy(): void {
this.map.instance.removeInteraction(this.instance);
}
}
Loading

0 comments on commit 2790be0

Please sign in to comment.