From b6b0973e2f13969c270f7eb266923ce88ddac5a1 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 28 Jun 2022 11:24:26 +0200 Subject: [PATCH] test: extend test case for #11960 2 --- test/types/document.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/types/document.test.ts b/test/types/document.test.ts index 7dfddb3278a..3a26d4b15b9 100644 --- a/test/types/document.test.ts +++ b/test/types/document.test.ts @@ -240,4 +240,18 @@ async function gh11960() { doc.nested!.parent(); doc.nestedArray?.[0].parentArray(); } + + { + const doc = await ParentModel.create({ + username: 'user1', + map: { key1: 'value1', key2: 'value2' }, + nested: { dummy: 'hello' }, + nestedArray: [{ dummy: 'hello again' }] + }); + + expectType & Parent & { _id: Types.ObjectId }>(doc); + expectType | undefined>(doc.map); + doc.nested!.parent(); + doc.nestedArray?.[0].parentArray(); + } }