...

/

Using the unknown type

Using the unknown type

In this lesson, we will learn about the 'unknown' type; it is similar to the 'any' type but is type-safe.

An any type refresher

We learned from a previous lesson that the any type could be used when we are unsure of the type of value. The problem with any is that no type checks will be carried out on values of type any.

What if there was a type like any that can be used for values we don’t know but was also type-safe? This is what the unknown type is!

Access this course and 1400+ top-rated courses and projects.