For any method where a Task is returned, we see the following error:
Type 'Document<unknown, {}, { type: "GetStats" | "ExportAnnotations" | "ExportImageErrors" | "CreateDeployment" | "UpdateDeployment" | "DeleteDeployment"; user: string; projectId: string; status: "SUBMITTED" | ... 2 more ... | "COMPLETE"; created: Date; updated: Date; output?: any; }> & { ...; } & { ...; }' is not assignable to type 'Task'.
Types of property '_id' are incompatible.
Type 'ObjectId' is not assignable to type 'string'.ts(2322)
This seems to be an issue where GraphQL expected the _id to be a string:
However, Mongoose shows it as an mongoose.Types.ObjectId. Calling .toObject() on the response object rectifies this. This may become a common pattern for our resolvers... I would like to imagine that there's a better way to handle this, but I'm not sure what that would be, perhaps something with the Scalars for the output?
For any method where a
Task
is returned, we see the following error:This seems to be an issue where GraphQL expected the
_id
to be a string:https://github.com/tnc-ca-geo/animl-api/blob/27b3e3d955208ffdaa061aeced28689e76644ad4/src/@types/graphql.ts#L1038 https://github.com/tnc-ca-geo/animl-api/blob/27b3e3d955208ffdaa061aeced28689e76644ad4/src/@types/graphql.ts#L10
However, Mongoose shows it as an
mongoose.Types.ObjectId
. Calling.toObject()
on the response object rectifies this. This may become a common pattern for our resolvers... I would like to imagine that there's a better way to handle this, but I'm not sure what that would be, perhaps something with the Scalars for the output?