The TypeScript keyword used to create a type that can be one of several types is called ________.

  • union
  • any
  • object
  • function
The TypeScript keyword used to create a type that can be one of several types is called union. Unions are used to specify that a value can have one of several possible types. This is valuable for scenarios where a variable or property can accept multiple data types. The other options (any, object, function) do not specifically define a type that can be one of several types.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *