Skip to content
beginner

Union Types

Use union types to allow a variable to hold multiple types.

type StringOrNumber = __________...;

function formatValue(value: StringOrNumber): string {
  if (typeof value === '______') {
    return value.toUpperCase();
  }
  return __________...;
}
0/3 filled tab moves · Ctrl+↵ submits · Ctrl+Shift+↵ runsstarter code