// enums
enum ResourceType {
BOOK,
AUTHOR,
FILM,
DIRECTOR,
PERSON,
}
interface Resource<T> {
uid: number;
resourceType: ResourceType;
data: T;
}
const docOne: Resource<object> = {
uid: 1,
resourceType: ResourceType.BOOK, // 0
data: { title: "name of the wind" },
};
const docTwo: Resource<object> = {
uid: 10,
resourceType: ResourceType.PERSON, // 4
data: { name: "Jack" },
};
참고
https://www.youtube.com/watch?v=r8G7-hQG07o&list=PL4cUxeGkcC9gUgr39Q_yD6v-bSyMwKPUI&index=19