The "Any" type

A type that can be anything.

Essential Types

We can use any when we don't want to specify a type. any is a special type in TypeScript that will not produce any type-checking errors, which means we can assign a value of any kind:

let character: any;

character = { name: "Mario" };
character = "Mario";
character = 1;

This is similar to how JavaScript works, but we're using TypeScript to get the benefits of type-checking, right?

any can be helpful in certain cases, but it's best to avoid it when possible.

Let's see why! 👉

Loading...