For example, the type string in TypeScript is the set of all possible strings. When you get down to a fundamental definition, a type is a set of possible values, and nothing more. When to use the unknown type in TypeScript.To understand those uses, we will be doing a deep dive into TypeScript types. TypeScript is carefully designed according to principles of type theory, but it is also a practical language, and its features all have practical uses – including never and unknown. These two types represent fundamental and complementary aspects of type theory. The never and unknown primitive types were introduced in TypeScript v2.0 and v3.0, respectively. When to use never and unknown in TypeScriptĮditor’s note: This article was last updated by Abhinav Anshul on to include information about type inference and type annotations, type guards and type assertions, and type narrowing with unknown. Jesse Hallett Follow I am a software engineer in NYC with special interests in frontend programming and type-driven development.