typescript: Statically Kind Unknown Values with TypeScript’s unknown Kind

On this lesson, we will pass over TypeScript’s unknown form. The unknown form is the type-safe counterpart of the any form. Each unknown and any are so-called best varieties (often referred to as common supertypes) of the kind device. Because of this each form in TypeScript is assignable to each unknown and any.

The primary distinction between the two varieties is that unknown is far much less permissive than any: We need to do a little type of checking prior to acting maximum operations on values of form unknown, while we do not need to do any assessments prior to acting operations on values of form any.

Any other distinction is that any is assignable to each form, while unknown is best assignable to any and unknown itself. To assign unknown to every other varieties, we need to slim it to a extra particular form first.

Further Studying