Basic types
TypeScript has a rich set of built-in types, which can be categorized into the following groups:
- Primitive types: These are the basic data types in TypeScript, including
number
,string
,boolean
,null
, andundefined
. - Object types: These include
object
,array
,function
, andclass
. - Union types: These allow you to combine multiple types into one.
- Any type: This type can hold any value, and is used when the type of a variable is not known.
- Void type: This is used to indicate that a function does not return a value.