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

Async methods are missing in Typescript typings #164

Closed
ThomasPiskol opened this issue Aug 19, 2020 · 5 comments
Closed

Async methods are missing in Typescript typings #164

ThomasPiskol opened this issue Aug 19, 2020 · 5 comments

Comments

@ThomasPiskol
Copy link

Description

According to the readme this library provides async methods for the JwksClient:

Note that all methods on the JwksClient have asynchronous equivalents, where the promisified name is suffixed with Async, e.g., client.getSigningKeyAsync(kid).then(key => { /* ... */ });

But these methods are not included in the index.d.ts and therefore cannot be used in Typescript.

Reproduction

Just take a look at the definition of JwksClient in index.d.ts:

declare namespace JwksRsa {
  class JwksClient {
    constructor(options: ClientOptions);

    getKeys(cb: (err: Error | null, keys: unknown) => void): void;
    getSigningKeys(cb: (err: Error | null, keys: SigningKey[]) => void): void;
    getSigningKey: (kid: string, cb: (err: Error | null, key: SigningKey) => void) => void;
  }

As you can see the methods getKeysAsync, getSigningKeysAsync and getSigningKeyAsync are missing.
In index.js the async methods are defined like this:

    this.getKeysAsync = promisifyIt(this.getKeys, this);
    this.getSigningKeysAsync = promisifyIt(this.getSigningKeys, this);
    this.getSigningKeyAsync = promisifyIt(this.getSigningKey, this);

Environment

Please provide the following:

  • Version of this library used: 1.9.0
  • Version of the platform or framework used, if applicable: n/a
  • Other relevant versions (language, server software, OS, browser): Typescript 3.9.7
  • Other modules/plugins/libraries that might be involved: n/a
@ThomasPiskol
Copy link
Author

If you integrate #163 this issue will be fixed. I've tested the changes locally.

@hsks
Copy link

hsks commented Sep 1, 2020

Would be lovely if someone could just merge it.

@joeykilpatrick
Copy link

@hsks Looks like it was merged, just hasn't been released. Hoping it will be released as 1.9.1 soon.

@hsks
Copy link

hsks commented Sep 2, 2020

@joeykilpatrick True. My bad. Waiting for it to be release soon 🤞 . Till then promisification of those functions should help.

@davidpatrick
Copy link
Contributor

We are aiming at cutting a release for this today

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

No branches or pull requests

4 participants