File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -453,7 +453,7 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
453453 async withTransaction < T = any > (
454454 fn : WithTransactionCallback < T > ,
455455 options ?: TransactionOptions
456- ) : Promise < Document | undefined > {
456+ ) : Promise < T > {
457457 const startTime = now ( ) ;
458458 return attemptTransaction ( this , startTime , fn , options ) ;
459459 }
Original file line number Diff line number Diff line change 1- import { type ClientSession , MongoClient , ReadConcern } from '../../mongodb' ;
1+ import { expectType } from 'tsd' ;
2+
3+ import { type ClientSession , type InsertOneResult , MongoClient , ReadConcern } from '../../mongodb' ;
24
35// TODO(NODE-3345): Improve these tests to use expect assertions more
46
@@ -111,11 +113,7 @@ try {
111113client . withSession ( session => runTransactionWithRetry ( updateEmployeeInfo , client , session ) ) ;
112114
113115const col = client . db ( 'test' ) . collection < { _id : string } > ( 'col' ) ;
114- const ok = await session . withTransaction ( async ( ) => {
116+ const insertResult = await session . withTransaction ( async ( ) => {
115117 return await col . insertOne ( { _id : 'one' } , { session } ) ;
116118} ) ;
117- if ( ok ) {
118- console . log ( 'success' ) ;
119- } else {
120- console . log ( 'nothing done' ) ;
121- }
119+ expectType < InsertOneResult < { _id : string } > > ( insertResult ) ;
You can’t perform that action at this time.
0 commit comments