DEV Community

Darshan Kumar
Darshan Kumar

Posted on

1

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.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

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?

Image of Docusign

πŸ› οΈ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more