我正在使用API端点处理类别,因此我为此创建了enum
:
export enum categories {
DESIGN = 'design',
ART = 'art',
WRITING = 'writing',
PHOTOGRAPHY = 'photography',
MUSIC = 'music',
DIGITAL = 'digital',
MEDIA = 'media'
}
现在我想用它来为数据库中的category
属性设置接口。
interface
:
interface ProjectAttrs {
user: string;
title: string;
description: string;
category: // <== I want it to be either of those values defined above
}
如何将类别接口类型指定为枚举中定义的值之一?
答案 0 :(得分:1)
只需将枚举名称override rwxr-xr-x root/wheel restricted,compressed for python3? y
rm: python3: Operation not permitted
像这样:
categories
这是工作中的demo