File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,14 +57,21 @@ export class LoggingDatabaseOperations implements DatabaseOperations {
5757
5858 // Constrain T to only callable (function) members of DatabaseOperations,
5959 // excluding non-function properties like `engineKind` (which is a Promise).
60+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6061 private async logAndDelegate < T extends { [ K in keyof DatabaseOperations ] : DatabaseOperations [ K ] extends ( ...args : any ) => any ? K : never } [ keyof DatabaseOperations ] > (
6162 message : string ,
6263 isWrite : boolean ,
6364 method : T ,
65+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6466 ...args : Parameters < Extract < DatabaseOperations [ T ] , ( ...args : any ) => any > >
67+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6568 ) : Promise < ReturnType < Extract < DatabaseOperations [ T ] , ( ...args : any ) => any > > > {
6669 this . log ( message , isWrite ) ;
67- return ( this . wrapped [ method ] as any ) ( ...args ) ;
70+
71+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
72+ type AnyFunc = Extract < DatabaseOperations [ T ] , ( ...args : any ) => any > ;
73+ const targetMethod = this . wrapped [ method ] as unknown as ( ...args : Parameters < AnyFunc > ) => ReturnType < AnyFunc > ;
74+ return targetMethod ( ...args ) ;
6875 }
6976
7077 private log ( message : string , isWrite : boolean = false ) {
You can’t perform that action at this time.
0 commit comments