10 lines
287 B
TypeScript
10 lines
287 B
TypeScript
import { SchemaType, SchemaTypeOptions } from 'mongoose';
|
|
|
|
export const getSchemaTypeOptions = (schemaType: SchemaType): SchemaTypeOptions<{ localized: boolean }> => {
|
|
if (schemaType?.instance === 'Array') {
|
|
return schemaType.options.type[0];
|
|
}
|
|
|
|
return schemaType?.options;
|
|
};
|