TypeScript is a strongly type language.This means that variables and expressions are type checked at compile time.But if required we can turn off this behavior.
var var1 = 'string value';
var1 = 64;
Variable declaration in TypeScript
In TypeScript when we declare a variable we assign a type to it.For example we declare a string variable as:
stringValue: string = "some value";
The variable stringValue above is declared as string using type annotation.
Similarly we can declare number and boolean values as:
boolValue: boolean = false;
numericValue: number = 6;
If we required we can opt out of the strict type checking by using the “any” keyword.If we declare a variable as any type then it is not type checked at compile time.
let tempVariable: any = 53;
tempVariable = "string value";