Sobes.tech
Junior — Middle

Can you list the standard built-in data types provided by TypeScript?

sobes.tech AI

Answer from AI

TypeScript provides the following standard built-in data types:

  • boolean — logical type (true/false)
  • number — numeric type (integers and floating-point numbers)
  • string — string type
  • array — arrays, for example number[] or Array<string>
  • tuple — tuples with a fixed number of elements of different types, for example [string, number]
  • enum — enumerations for a set of named constants
  • any — universal type, disables type checking
  • void — absence of a value, usually for functions without a return value
  • null and undefined — special types for missing values
  • never — type for values that never occur (for example, a function that always throws an error)
  • object — type for objects that are not primitives

Example usage:

let isDone: boolean = false;
let count: number = 42;
let name: string = "TypeScript";
let list: number[] = [1, 2, 3];
let tuple: [string, number] = ["age", 30];