...

/

Understanding the any type

Understanding the any type

We will learn about the 'any' type in this lesson.

We'll cover the following...

An example #

The code below declares a variable called something and sets it to various values. From the last lesson, we know that TypeScript will give something the any type because there is no type annotation or value assignment in the declaration.

let something;
something = "Bob";
something = 33;
something = false;
something = new Date(2019, 5, 8);

What do you think the TypeScript type checker checks in the above code?

TypeScript doesn’t carry out type checking on items that have the any type. The ...