Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add type hinting for the JwtHelperService.decodeToken method #679

Conversation

patricio-ezequiel-hondagneu-roig
Copy link
Contributor

Changes

Updated the decodeToken method in the class JwtHelperService to accept a generic type argument that will be used as the type of the returned value, defaulting to any to preserve the current behavior when no type argument is used and avoid a breaking change.

With the change the user can hint the type of the value returned by the decodeToken method instead of having to resort to a type assertion.

Example of usage without a type hint:

Screenshot_25

Example of usage with a type hint:

Screenshot_26

References

Issue: #678

Checklist

@Sambego Sambego merged commit 2bdc702 into auth0:main Nov 19, 2020
@Sambego
Copy link
Contributor

Sambego commented Nov 19, 2020

Thanks for this contribution, it is available in version 5.0.2.

@patricio-ezequiel-hondagneu-roig
Copy link
Contributor Author

@Sambego thanks to you guys! Keep up the good work

@patricio-ezequiel-hondagneu-roig patricio-ezequiel-hondagneu-roig deleted the jwt-helper-service-decode-token-type-hint branch November 23, 2020 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants