TypeScript Data Type - Any
TypeScript has type-checking and compile-time checks. However, we do not always have prior knowledge about the type of some variables, especially when there are user-entered values from third party libraries. In such cases, we need a provision that can deal with dynamic content. The Any type comes in handy here.
let something: any = "Hello World!"; something = 23; something = true;
var something = "Hello World!"; something = 23; something = true;
Similarly, you can create an array of type any if you are not sure about the types of values that can contain this array.
let arr: any = ["John", 212, true]; arr.push("Smith"); console.log(arr); //Output: [ 'John', 212, true, 'Smith' ]
var arr = ["John", 212, true]; arr.push("Smith"); console.log(arr);