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

Incorrect typescript typings for 'Mux.JWT.sign()' #67

Closed
MBrendel opened this issue Sep 4, 2020 · 2 comments
Closed

Incorrect typescript typings for 'Mux.JWT.sign()' #67

MBrendel opened this issue Sep 4, 2020 · 2 comments

Comments

@MBrendel
Copy link
Contributor

MBrendel commented Sep 4, 2020

Currently the typings look like this:

export declare interface JWTOptions {
  keyId: string;
  keySecret: string;
  type: string;
  params?: any;
}

export declare class JWT {
  static sign(playbackId: string, options: JWTOptions): string;
}

All of the usage examples in the ReadMe (https://github.com/muxinc/mux-node-sdk#jwt-helpers-api-reference) cause typescript errors because:

  • the JWTOptions are not optional in the signature of the sign method
  • the keyId and the keySecret are not optional in the JWTOptions type

In addition JWTOptions do not contain the expiration parameter.

Suggested types:

export declare interface JWTOptions {
  type: string;
  keyId?: string;
  keySecret?: string;
  expiration?: string;
  params?: any;
}

export declare class JWT {
  static sign(playbackId: string, options?: JWTOptions): string;
}
@dylanjha
Copy link
Collaborator

dylanjha commented Sep 4, 2020

this was closed in #69 and released in v3.0.3 - see changelog: https://github.com/muxinc/mux-node-sdk/blob/master/CHANGELOG.md

@dylanjha dylanjha closed this as completed Sep 4, 2020
@MBrendel
Copy link
Contributor Author

MBrendel commented Sep 7, 2020

Thanks for merging the PR!

Unfortunately I missed in my previous change, that the type parameter is optional as well.

This PR #72 fixes this and makes the 'type' type stronger too.

export declare interface JWTOptions {
  type?: 'video' | 'thumbnail' | 'gif';
  keyId?: string;
  keySecret?: string;
  expiration?: string;
  params?: any;
}

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

2 participants