I have a method which launches a modalWindow which takes an element as input (using $event.target) or a number. I am trying to perform a check on the type of the input but the check always treats element as a number even if it's not. Whether or not element is a number the console.log is outputted and the else never runs.
launchModal(element: number | any) {
if (<number>element) {
console.log('ele as num', element);
} else {
const elementId = (event.target as Element).id;
const elementIdArray = String(elementId).split('-');
this.currentRow = parseInt(elementIdArray[2], 10);
}
this.loadEquipmentFullRowDataRequest(this.currentRow);
}
I following the documentation for advanced types at the official site