DEV Community

Darshan Kumar
Darshan Kumar

Posted on

Data Types of Typescript

Boolean: Represents a true or false value.
Number: Represents both integer and floating-point numbers.
String: Represents a sequence of characters.
Array: Represents a collection of elements of the same type.
Tuple: Represents an array with a fixed number of elements whose types are known.
Enum: Represents a group of named constant values.
Any: A type that allows any value. Useful when the type of a variable is unknown.
Void: Represents the absence of any type, commonly used as the return type of functions that do not return a value
Null and Undefined: Represents the absence of a value.
Never: Represents the type of values that never occur. Used as the return type for functions that always throw an error or never return.
Object: Represents a non-primitive type, i.e., anything that is not number, string, boolean, symbol, null, or undefined.
Unknown: Represents any value, similar to any, but safer because you can't perform operations on an unknown type without first asserting or narrowing it to a more specific type.

Top comments (1)

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Symbols are a primitive type, not an object. Also, does TypeScript not support BigInt? Or have you forgotten that?