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

Fix typescript typings #80

Merged
merged 10 commits into from
Jun 3, 2019
Merged

Fix typescript typings #80

merged 10 commits into from
Jun 3, 2019

Conversation

fnberta
Copy link
Contributor

@fnberta fnberta commented Feb 4, 2019

The typescript typings are not really accurate at the moment. This fixes them. Note that jwt-express types should be listed in dependencies (as they are now) because we re-export a type from that package.

Incorporates #73, #69, #54.
Fixes #46, #28, #78, #75.

@tinaroh
Copy link

tinaroh commented Apr 26, 2019

auth0, please merge this!

@AlexRex
Copy link

AlexRex commented May 14, 2019

Please! Merge!

index.d.ts Outdated

function koaJwtSecret(options: JwksRsa.Options): (name: string, scheme: string, options?: any) => void;
function hapiJwt2KeyAsync(options: HapiJwtOptions): (decodedToken: DecodedToken) => Promise<{ key: SigningKey }>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(decodedToken: DecodedToken) => Promise<{ key: SigningKey }>;

this is actually wrong. it does not return a promise of SigningKey, they key property is just a string with the value. See:

I wrote a test for verifying the typings here #98

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks! Fixed it.

@fnberta fnberta requested a review from a team June 2, 2019 19:10
@@ -5,6 +5,7 @@
"main": "lib/index.js",
"types": "index.d.ts",
"dependencies": {
"@types/express-jwt": "0.0.41",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a dev dependency

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TypeScript handbook recommends using dependencies, because otherwise consumers will have to install @types/express-jwt manually: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#dependencies

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the link!

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.

koaJwtSecret type declaration is incorrect
6 participants