What is 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.Example: Any Copy The above code will […]

What is TypeScript – Union

TypeScript allows us to use more than one data type for a variable or a function parameter. This is called union type.Syntax: (type1 | type2 | type3 | .. | typeN) Consider the following example of union type.Example: Union Copy In the above example, variable code is of union type, denoted using (string | number). So, you can assign […]