Skip to content

Commit 0ecbcb3

Browse files
authored
[Cosmos] Downcast to ItemDefinition (#3283)
- Required by improved soundness check introduced in TS 3.5.1 - microsoft/TypeScript#31661
1 parent e712441 commit 0ecbcb3

File tree

1 file changed

+2
-2
lines changed
  • sdk/cosmosdb/cosmos/src/client/Item

1 file changed

+2
-2
lines changed

sdk/cosmosdb/cosmos/src/client/Item/Items.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export class Items {
211211
// Generate random document id if the id is missing in the payload and
212212
// options.disableAutomaticIdGeneration != true
213213
if ((body.id === undefined || body.id === "") && !options.disableAutomaticIdGeneration) {
214-
body.id = Helper.generateGuidId();
214+
(body as ItemDefinition).id = Helper.generateGuidId();
215215
}
216216

217217
const err = {};
@@ -268,7 +268,7 @@ export class Items {
268268
// Generate random document id if the id is missing in the payload and
269269
// options.disableAutomaticIdGeneration != true
270270
if ((body.id === undefined || body.id === "") && !options.disableAutomaticIdGeneration) {
271-
body.id = Helper.generateGuidId();
271+
(body as ItemDefinition).id = Helper.generateGuidId();
272272
}
273273

274274
const err = {};

0 commit comments

Comments
 (0)