Currently tackling an angular project that is functioning flawlessly, yet encountering a linting test failure. Unfortunately, the information provided in this post did not offer much assistance. The error message I'm facing reads as follows:
ERROR: C:/Users/.../monthpicker.component.ts:164:22 - Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead.
Lint errors found in the listed files.
The problematic code on line 164 within my ts file appears like so:
testMethod() {
this.text = (<HTMLInputElement>document.getElementById('rangeInput')).value;
}
Still fairly new to Angular, I am unsure of the appropriate steps to rectify this issue. Removing the <>
characters proves challenging as the rangeInput
element is integral to my HTML structure:
<input id="rangeInput" [ngModel]="text" placeholder="Select range" />
Your guidance is highly appreciated in resolving this matter and successfully passing the linting test. Currently utilizing Node v10.15.3
.
PS: It's worth noting that no errors or warnings occur during regular project operation; the linting tests only surface upon initiating a git push
.