Skip to content

Commit

Permalink
refactor: allow generic in decode return type
Browse files Browse the repository at this point in the history
  • Loading branch information
drlappies committed Aug 25, 2023
1 parent d5fbe70 commit 38d4d81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/jwt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ export class JwtService {
) as Promise<T>;
}

decode(
decode<T extends object = any>(
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(
Expand Down

0 comments on commit 38d4d81

Please sign in to comment.