Open
Description
Description
If you import * as jwt from "jsonwebtoken"
, then you can't call jwt.decode
. It works fine if you use a default import though (import jwt from "jsonwebtoken"
).
Related to #866, and probably also #870.
The root cause of this is that import *
in TS gets translated in such a way that only enumerable properties are copied from the module. Since decode
is non-enumerable it is not properly copied.
Reproduction
import * as jwt from "jsonwebtoken";
jwt.decode("abc"); // TypeError: jwt.decode is not a function
Environment
Version 9.0.0 on Node 16.19.0 with TS 4.6.2
Metadata
Metadata
Assignees
Labels
No labels