Open
Description
Description
Expected
A patch update should not break a compilation.
Result
In 8.3.8 the value in options for Algorithm was changed to an enum. This causes typescript to break on compile if you are passing in a string for the algorithm. Since algorithm is now typed, it doesn't match SignOptions
type, and the signature for sign using a callback method is instead matched.
Reproduction
Compiles successfully on 8.3.5 but fails on 8.3.8 (node 12.11.1)
@types/jsonwebtoken
const signOptions: SignOptions = {
header: { alg: 'HS256', typ: 'JWT'},
expiresIn: 3600,
algorithm: 'HS256',
}
const token = jwt.sign(payload, Buffer.from(value).toString('base64'), signOptions);
works
const signOptions: SignOptions = {
header: { alg: 'HS256', typ: 'JWT'},
expiresIn: 3600,
algorithm: 'HS256' as jwt.Algorithm ,
}
const token = jwt.sign(payload, Buffer.from(value).toString('base64'), signOptions);
Metadata
Metadata
Assignees
Labels
No labels