Wednesday, May 31, 2017

How to declare the variable in Type Script

Customer.Ts:

class CustomerDetails{
  public CustomerName: string = "";
  public CustomerNumber: int = 0;
}


  • First should define the type of scope "Public / Private / Protected etc....".
  • Next, give the name of the varible.
  • Next, provide the type of variable as "string / int / boolean etc...." but before this we should have ":" to declare the type of variable.

No comments:

Post a Comment