Currently, I have been working on a project using both Node JS
and Typescript
, where my main challenge lies in sharing variables between different classes within the same file.
The class from which I need to access the max
variable is:
export class constUt {
env: string;
max: number;
constructor() {
this.env = 'dev';
this.max = 100;
}
}
And here is the class where I am struggling to retrieve the max
variable:
export class callBack {
private utilsCo = new constUt();
call = function (err:any, csv:any) {
console.log(`max constUt: ${this.utilsCo.max}`); //error
if (err) throw err;
}
}
My current issue revolves around finding a way to access the max
variable inside the call
function.