Exploring Primitive Types

Learn about primitive types and their use in TypeScript, and take a detailed look at null and undefined types.

Primitive types

What are primitive types? In programming, a primitive is a data type that is not derived from any other type and is not an object. They are the most basic types available in a programming language and are typically the building blocks for more complex data structures.

A few of the basic or primitive types that are available in TypeScript are numbers, strings, and booleans. While these represent some of the most basic and widely used types in the language, there are quite a few more, including undefined, null, unknown, and never.

Related to these primitive types, we also have some language features, such as conditional expressions and optional chaining, that provide a convenient shorthand method of writing otherwise rather long-winded code.

Get hands-on with 1200+ tech skills courses.