相关疑难解决方法(0)

在打字稿前端项目中使用 jwt-decode

描述 我试图在打字稿项目中使用 jwt-decode,即 Stencil 项目 & 它抛出以下错误:

此表达式不可调用。Type '{ default: (token: string, options?: Options) => TTokenDto; }' 没有调用签名。

import * as jwt_decode from 'jwt-decode';
.
.
.
let token = "........";
let decoded = jwt_decode(token);
Run Code Online (Sandbox Code Playgroud)

再生产

  • 在任何打字稿项目中安装 jwt-decode npm install --save @types/jwt-decode npm install --save jwt-decode 在你的代码中导入它并使用 import * as jwt_decode from 'jwt-decode'; . . . 让令牌 = "........"; 让解码 = jwt_decode(token);
  • 构建项目
  • 使用的这个库的版本:^2.2.0 平台版本或
  • 使用的框架(如果适用):模板 - ^1.3.3 ,打字稿 - 3.7.2

jwt typescript auth0

7
推荐指数
1
解决办法
2744
查看次数

标签 统计

auth0 ×1

jwt ×1

typescript ×1