Reputation: 3186
I am working with categories with my API endpoint and so I have created this enum
for it :
export enum categories {
DESIGN = 'design',
ART = 'art',
WRITING = 'writing',
PHOTOGRAPHY = 'photography',
MUSIC = 'music',
DIGITAL = 'digital',
MEDIA = 'media'
}
And now I want to use this to set an interface for the category
attribute in my database.
interface
for that :
interface ProjectAttrs {
user: string;
title: string;
description: string;
category: // <== I want it to be either of those values defined above
}
How do I specify the category interface type to be either of the values defined in the enum?
Upvotes: 0
Views: 174