Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Typing and eslint fixes

Alexander Brandon Coles5453cc8f4b76
diff --git a/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts b/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts
index 60c433a5b22..dd71fd918ea 100644
--- a/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts
+++ b/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core';
+import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnInit, OnDestroy } from '@angular/core';
import { debounceTime } from 'rxjs/operators';
import { TransitionService } from '@uirouter/core';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
@@ -47,7 +47,7 @@ import { fromEvent } from 'rxjs';
changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, AfterViewInit {
+export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, AfterViewInit, OnDestroy {
@Input() elementClass:string;
@Input() resizeEvent:string;
@@ -56,7 +56,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
@Input() variableName:string = '--split-screen-width';
- private resizingElement:HTMLElement;
+ private resizingElement:HTMLElement|null;
private elementWidth:number;
@@ -72,7 +72,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
public resizerClass = 'work-packages--resizer icon-resizer-vertical-lines';
constructor(
- private elementRef:ElementRef,
+ private elementRef:ElementRef<HTMLElement>,
readonly $transitions:TransitionService,
) {
super();
@@ -83,7 +83,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
// We use this more complicated approach of taking the last element of the class as it allows
// to still work in case an element is duplicated by Angular.
const elements = document.getElementsByClassName(this.elementClass);
- this.resizingElement = <HTMLElement>elements[elements.length - 1];
+ this.resizingElement = elements[elements.length - 1] as HTMLElement|null;
if (!this.resizingElement) {
return;
@@ -118,7 +118,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
ngAfterViewInit():void {
// Get the reziser
- this.resizer = <HTMLElement> this.elementRef.nativeElement.getElementsByClassName(this.resizerClass)[0];
+ this.resizer = this.elementRef.nativeElement.getElementsByClassName(this.resizerClass)[0] as HTMLElement;
this.applyColumnLayout();
}
@@ -131,7 +131,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
// In case we dragged the resizer farther than the element can actually grow,
// we reset it to the actual width at the start of the new resizing
const localStorageValue = this.parseLocalStorageValue();
- const actualElementWidth = this.resizingElement.offsetWidth;
+ const actualElementWidth = this.resizingElement?.offsetWidth || 0;
if (localStorageValue && localStorageValue > actualElementWidth) {
this.elementWidth = actualElementWidth;
}
@@ -187,6 +187,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
return undefined;
}
+
private applyColumnLayout(checkWidth = 750) {
const singleView = document.querySelector<HTMLElement>("[data-selector='wp-single-view']");
if (singleView) {
diff --git a/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts b/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
index 1be7bbd715b..1aed8c6cb9a 100644
--- a/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
+++ b/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
@@ -95,7 +95,7 @@ export class SpotDropModalComponent implements OnDestroy {
@ViewChild('anchor') anchor:ElementRef;
- @ViewChild('body') body:TemplateRef<any>;
+ @ViewChild('body') body:TemplateRef<unknown>;
@ViewChild('focusGrabber') focusGrabber:ElementRef;