TypeScript: Global static variable best practice

Definitely method 2 since that is the class that is using the variable. So it should contain it.

In case 1 you are using a variable that will become confusing once you have more than one classes in there e.g:

module M {

  var count : number = 0;

  export class C {
    constructor() {
      count++;
    }
  }

  export class A{
  }
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)