Typescript union equivalent in Mongoose?

Viewed 286

I've gotten used to thinking with typescript, and I'm trying to store the following with mongoose.

interface Point {
    x: number;
    y: number;
}

interface Line {
   start: Point;
   end: Point;
}

interface Arc {
    center: Point;
    radius: number;
    startAngle: number;
    sweep: number;
}

type Feature = Line | Arc;

Is there a way to represent Feature in mongoose without using Mixed? I don't want to lose the benefits of the schema, but I need to define a few different types to fill the same child attribute.

0 Answers
Related