Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

TSLint found two errors #687

Closed
Hamoonist opened this issue Sep 10, 2018 · 3 comments
Closed

TSLint found two errors #687

Hamoonist opened this issue Sep 10, 2018 · 3 comments

Comments

@Hamoonist
Copy link

This is the code I use:

`function generateToken(iden,room){
const AccessToken = twilio.jwt.AccessToken;
const token = new AccessToken(
envconf.twilio.sid,
envconf.twilio.apikey,
envconf.twilio.apisecret,
)
token.identity = iden;
const grant = new twilio.jwt.AccessToken.VideoGrant()
token.addGrant(grant);
return token.toJwt();

}`

and TSLint says AccessToken does not have identity
also says toJwt() needs an argument!

@po5i
Copy link
Contributor

po5i commented Oct 11, 2018

I find it better for TS to include the identity as an option like:

const token = new AccessToken(
    envconf.twilio.sid,
    envconf.twilio.apikey,
    envconf.twilio.apisecret,
    {identity: iden}
)

or using AccessTokenOptions interface like defined here: https://github.com/twilio/twilio-node/blob/master/lib/jwt/AccessToken.d.ts#L17

About toJwt() it needs the algorithm argument: https://github.com/twilio/twilio-node/blob/master/lib/jwt/AccessToken.d.ts#L30 but it's optional 🤔

@po5i po5i closed this as completed Oct 11, 2018
@Hamoonist
Copy link
Author

the problem is caused by the TS interference bugs, which are solved in thiscommit
but that there are no releases after that commit, so I can't use them,
instead, I solved the problem by rolling back to version 3.19.1, which doesn't have any TS files

@Hamoonist
Copy link
Author

Well, actually I just checked and there is a new release! I am going to try that!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants