Skip to content

Commit e436f6a

Browse files
authored
Merge pull request #15115 from Automattic/vkarpov15/gh-15101
types: add UUID to RefType
2 parents c00b674 + 585abde commit e436f6a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/typescript/populate.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ However, we recommend using the `.populate<{ child: Child }>` syntax from the fi
9696
Here's two reasons why:
9797

9898
1. You still need to add an extra check to check if `child instanceof ObjectId`. Otherwise, the TypeScript compiler will fail with `Property name does not exist on type ObjectId`. So using `PopulatedDoc<>` means you need an extra check everywhere you use `doc.child`.
99-
2. In the `Parent` interface, `child` is a hydrated document, which makes it slow difficult for Mongoose to infer the type of `child` when you use `lean()` or `toObject()`.
99+
2. In the `Parent` interface, `child` is a hydrated document, which makes it difficult for Mongoose to infer the type of `child` when you use `lean()` or `toObject()`.

types/index.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ declare module 'mongoose' {
572572
| typeof Schema.Types.Number
573573
| typeof Schema.Types.String
574574
| typeof Schema.Types.Buffer
575-
| typeof Schema.Types.ObjectId;
575+
| typeof Schema.Types.ObjectId
576+
| typeof Schema.Types.UUID;
576577

577578

578579
export type InferId<T> = T extends { _id?: any } ? T['_id'] : Types.ObjectId;

0 commit comments

Comments
 (0)