What is the default visibility of a variable in TypeScript, what is the importance of var when declaring variables?

2

When declaring a variable, when we omit the visibility parameter (public, private, and protected) the variable is created by default in what visibility?

export class AddEditTaskPage {

  idade: number;
  valor: string;
....

Just one more question, is the word var optional? Do you have any special reason to use it?

export class AddEditTaskPage {

  var idade: number;
  valor: string;
....
    
asked by anonymous 22.09.2018 / 19:46

1 answer

0

It's public by default .

In TypeScript, in class members, var is unnecessary, the semantics of var is adopted even without its explicit use.

    
23.09.2018 / 17:27