mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Merge pull request #6978 from QuatroDevOfficial/jwt-decode
Add jwt-decode.d.ts
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/// <reference path="jwt-decode.d.ts" />
|
||||
import jwtDecode = require('jwt-decode');
|
||||
|
||||
let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo";
|
||||
|
||||
interface TokenDto {
|
||||
foo: string;
|
||||
exp: number;
|
||||
iat: number;
|
||||
}
|
||||
|
||||
let decodedToken = jwtDecode(token) as TokenDto;
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for jwt-decode v1.4.0
|
||||
// Project: https://github.com/auth0/jwt-decode
|
||||
// Definitions by: Giedrius Grabauskas <https://github.com/QuatroDevOfficial/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module JwtDecode {
|
||||
interface JwtDecodeStatic {
|
||||
(token: string): any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'jwt-decode' {
|
||||
var jwtDecode: JwtDecode.JwtDecodeStatic;
|
||||
export = jwtDecode;
|
||||
}
|
||||
Reference in New Issue
Block a user