Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/mongo_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export type InferIdType<TSchema> = TSchema extends { _id: infer IdType }
/** Add an _id field to an object shaped type @public */
export type WithId<TSchema> = EnhancedOmit<TSchema, '_id'> & { _id: InferIdType<TSchema> };

/** Add timestamp fields (createdAt and updatedAt) to an object shaped type @public */
export type WithTimestamp<TSchema> = TSchema & { createdAt: Date; updatedAt: Date };

/**
* Add an optional _id field to an object shaped type
* @public
Expand Down