Skip to content

Commit

Permalink
Ref added strict null checking for parentElement
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorenzo Iovino committed Jan 9, 2024
1 parent f62bbf7 commit 95adc81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/directives/ng2-fittext.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ export class Ng2FittextDirective
getStartFontSizeFromHeight(): number {
return this.container
? this.container.clientHeight
: this.el.nativeElement.parentElement.clientHeight;
: this.el.nativeElement.parentElement!.clientHeight;
}

private getStartFontSizeFromWeight(): number {
return this.container
? this.container.clientWidth
: this.el.nativeElement.parentElement.clientWidth;
: this.el.nativeElement.parentElement!.clientWidth;
}

isDone(): boolean {
Expand All @@ -164,7 +164,7 @@ export class Ng2FittextDirective
return this.container
? this.checkOverflow(this.container, this.el.nativeElement)
: this.checkOverflow(
this.el.nativeElement.parentElement,
this.el.nativeElement.parentElement!,
this.el.nativeElement
);
}
Expand Down

0 comments on commit 95adc81

Please sign in to comment.