beginner30 minby DevFox

Union types

Give a value that comes in more than one kind a type of its own with |, like a fridge sheet of minutes where one day says “sick”. See why TypeScript allows a line on a union only when every member allows it, read which member an error names, and put the parentheses of (string | number)[] in the right place.

  • TypeScript
  • Fundamentals
Union types. Read this lesson at .