Skip to content

Built-in Type Primitives

TypeScript has several built-in type primitives that can be used to define variables, function parameters, and return types:

  • number: Represents numeric values, including integers and floating-point numbers.
  • string: Represents textual data
  • boolean: Represents logical values, which can be either true or false.
  • null: Represents the absence of a value.
  • undefined: Represents a value that has not been assigned or has not been defined.
  • symbol: Represents a unique identifier. Symbols are typically used as keys for object properties.
  • bigint: Represents arbitrary-precision integers.
  • any: Represents a dynamic or unknown type. Variables of type any can hold values of any type, and they bypass type checking.
  • void: Represents the absence of any type. It is commonly used as the return type of functions that do not return a value.
  • never: Represents a type for values that never occur. It is typically used as the return type of functions that throw an error or enter an infinite loop.