Type alias InferIdType<TSchema>

InferIdType<TSchema>: TSchema extends {
        _id: infer IdType;
    }
    ? Record<any, never> extends IdType
        ? never
        : IdType
    : TSchema extends {
            _id?: infer IdType;
        }
        ? unknown extends IdType
            ? mongoose.mongo.BSON.ObjectId
            : IdType
        : mongoose.mongo.BSON.ObjectId

Given an object shaped type, return the type of the _id field or default to ObjectId

Type Parameters

  • TSchema

Generated using TypeDoc