Skip to content

TypeScript declare a type that can be a string or array of strings

FULL-STACK WEB DEVELOPMENT BOOTCAMP

2024 COHORT SIGNUPS END TOMORROW

Simple one, but I forgot the exact syntax and had to search for it, so let me write it:

export interface Props {
  tag: string | string[]
}

tag can be a string, or an array of strings

  • Learn modern web development in my BOOTCAMP (SIGNUP END TOMORROW FEB 20, 2024)
  • THE VALLEY OF CODE (+ PRO), your web development manual
  • I wrote 15+ coding BOOKS, all available in THE VALLEY OF CODE PRO
  • Indie solopreneur internet business masterclass SOLO LAB (summer 2024)