@@ -397,7 +397,7 @@ class MongoshNodeRepl implements EvaluationListener {
397397 }
398398
399399 setupHistoryCommand ( ) : void {
400- const getHistory = ( ) => {
400+ const history = ( ) => {
401401 // eslint-disable-next-line @typescript-eslint/no-explicit-any
402402 const replHistory : string [ ] = ( this . runtimeState ( ) . repl as any ) . history ;
403403 const formattedHistory =
@@ -408,7 +408,7 @@ class MongoshNodeRepl implements EvaluationListener {
408408 formattedHistory [ util . inspect . custom as any ] = ( ( ) => {
409409 return formatOutput (
410410 {
411- // The value of the format has to be a copy of the history to avoid circular references .
411+ // Providing a copy of the history avoids a circular reference .
412412 value : formattedHistory . concat ( ) ,
413413 } ,
414414 { colors : true , maxArrayLength : Infinity }
@@ -418,20 +418,7 @@ class MongoshNodeRepl implements EvaluationListener {
418418 return formattedHistory ;
419419 } ;
420420
421- getHistory . isDirectShellCommand = true ;
422- getHistory . returnsPromise = false ;
423- getHistory . acceptsRawInput = true ;
424-
425- this . runtimeState ( ) . context . history =
426- // eslint-disable-next-line @typescript-eslint/no-explicit-any
427- ( this . runtimeState ( ) . instanceState . shellApi as any ) . history = getHistory ;
428- // eslint-disable-next-line @typescript-eslint/no-explicit-any
429- ( signatures . ShellApi . attributes as any ) . history = {
430- type : 'function' ,
431- returnsPromise : true ,
432- isDirectShellCommand : true ,
433- acceptsRawInput : true ,
434- } as TypeSignature ;
421+ this . runtimeState ( ) . context . history = history ;
435422 }
436423
437424 private async finishInitializingNodeRepl ( ) : Promise < void > {
0 commit comments