Which of the following is a valid string literal type in TypeScript?

TypeScript Associate Easy

TypeScript Associate — Easy

Which of the following is a valid string literal type in TypeScript?

Key points

  • String literal types in TypeScript allow for specific string values.
  • Using the pipe symbol (|) allows for multiple valid string options.
  • This restricts the Direction type to only 'left' or 'right'.

Ready to go further?

Related questions