From c7f6a04cb83af982bdec26938c0d6e3d29ca367e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20R=C3=A4ntil=C3=A4?= Date: Wed, 11 Jan 2023 10:47:25 +0100 Subject: [PATCH] fix(typescript): fixed compiling on TS 4.9 --- lib/index.ts | 8 ++++++-- package.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index d74828e..596b7f6 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1318,10 +1318,14 @@ export function wrapFunction< T, R extends Promise< void > | void >( } if ( - cbRet && typeof ( < Promise< U > >cbRet ).then === "function" + cbRet && + typeof ( cbRet as Promise< U > | U as Promise< U > ).then + === "function" ) { - return < Promise< U > >( < Promise< U > >cbRet ) + return < Promise< U > >( + cbRet as Promise< U > | U as Promise< U > + ) .finally( ( ) => callCleanup( cleanup ) ); } else diff --git a/package.json b/package.json index 27ea882..df0d297 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "trace-unhandled": "^2.0.1", "ts-jest": "^26.4.4", "tslint": "6.1.3", - "typescript": "4.5.4" + "typescript": "4.9.4" }, "config": { "commitizen": {