using Mongo db, so it seems like enumName has no effect :(
I want to have a field which is enum in the database, i thought "select" type is the natural choice, but it fails to create typescript type
{
name: 'resources',
type: 'array',
fields: [
{
name: 'fieldIndex',
type: 'number',
required: true,
},
{
name: 'EResource',
type: 'select',
options: enumToArray(EResources),
enumName: 'EResources',
required: true,
},
{
name: 'ETier',
type: 'select',
options: enumToArray(ETier),
enumName: 'ETier',
required: true,
},
],
required: true,
}
but when generate types i get:
resources: {
fieldIndex: number;
EResource: '0' | '1' | '2' | '3';
ETier: '0' | '20' | '40' | '60' | '80' | '100';
id?: string | null;
}[];
what would be the option instead of select that could link the enum type correctly so i dont have to map my objects when reading and writing?
here are enums mentioned above:
export enum EResources {
None = 0,
Pebbles = 1,
Wood = 2,
Water = 3,
}
export enum ETier {
'NONE' = 0,
't1' = 20,
't2' = 40,
't3' = 60,
't4' = 80,
't5' = 100,
}