I'm using VS Code. It's based on TypeScript, it uses all TS definitions. The problem is with jsonwebtoken library. jwt.sign(...,) doesn't have Object.
// Type definitions for jsonwebtoken 7.2.0
// Project: https://github.com/auth0/node-jsonwebtoken
// Definitions by: Maxime LUCE https://github.com/SomaticIT, Daniel Heim https://github.com/danielheim
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export declare function sign(payload: string | Buffer | object, secretOrPrivateKey: string | Buffer, options: SignOptions, callback: SignCallback): void;
In JWT you can pass any object you want, but simple jwt.sign({userId: 1},...) doesn't work it says:
Argument of type '{ userId: number; }' is not assignable to parameter of type 'string | object | Buffer'.
Object literal may only specify known properties, and 'userId' does not exist in type 'string | object | Buffer'.
I'm using VS Code. It's based on TypeScript, it uses all TS definitions. The problem is with
jsonwebtokenlibrary.jwt.sign(...,)doesn't have Object.// Type definitions for jsonwebtoken 7.2.0
// Project: https://github.com/auth0/node-jsonwebtoken
// Definitions by: Maxime LUCE https://github.com/SomaticIT, Daniel Heim https://github.com/danielheim
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
In JWT you can pass any object you want, but simple
jwt.sign({userId: 1},...)doesn't work it says: