Question · Vue.js course · Module 15: TypeScript & Nuxt
Union Type in Props
How do you define a prop that only accepts the values 'online', 'offline', or 'maintenance'?
Answer options
- status: String.oneOf('online', 'offline', 'maintenance')
- status: 'online' | 'offline' | 'maintenance'
- status: enum('online', 'offline', 'maintenance')
- status: [online, offline, maintenance]
You can check the correct answer by solving this task in the CodeWorlds game.