Below is the typescript file in question:
module someModule {
declare var servicePort: string;
export class someClass{
constructor(){
servicePort = servicePort || ""; //ERROR= 'ReferenceError: servicePort is not defined'
}
I also attempted this approach within a function inside "someClass":
someFunction = () => {
if (servicePort && servicePort != '') { //ERROR - also servicePort is not defined
//do something with servicePort
}
}
When I define var servicePort in my js /html files, it works. However, since not all pages include the servicePort variable, I want to safely retrieve its value without causing exceptions. What mistake am I making?