From 38d4d8102e534fffa65af51dd9852e19c64c967a Mon Sep 17 00:00:00 2001 From: drlappies Date: Fri, 25 Aug 2023 23:48:04 +0800 Subject: [PATCH 1/2] refactor: allow generic in decode return type --- lib/jwt.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jwt.service.ts b/lib/jwt.service.ts index 5d688c7f..32fa84af 100644 --- a/lib/jwt.service.ts +++ b/lib/jwt.service.ts @@ -123,11 +123,11 @@ export class JwtService { ) as Promise; } - decode( + decode( token: string, options?: jwt.DecodeOptions - ): null | { [key: string]: any } | string { - return jwt.decode(token, options); + ): T { + return jwt.decode(token, options) as T; } private mergeJwtOptions( From 1c97d8937f5a9c4eee68192e0221f503c9a9c73c Mon Sep 17 00:00:00 2001 From: Kamil Mysliwiec Date: Thu, 9 Nov 2023 08:39:27 +0100 Subject: [PATCH 2/2] Update lib/jwt.service.ts --- lib/jwt.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jwt.service.ts b/lib/jwt.service.ts index 32fa84af..3bab80b4 100644 --- a/lib/jwt.service.ts +++ b/lib/jwt.service.ts @@ -123,7 +123,7 @@ export class JwtService { ) as Promise; } - decode( + decode( token: string, options?: jwt.DecodeOptions ): T {