web3-token
web3-token copied to clipboard
Type error: 'Web3Token' only refers to a type, but is being used as a value here.
In a NextJS 12.0.4 app using Typescript, I am getting npm run build
errors when I import the package like this:
import Web3Token from "web3-token";
The error:
Failed to compile.
./components/providers/Modal.tsx:125:23
Type error: 'Web3Token' only refers to a type, but is being used as a value here.
123 | });
124 | if (!token) {
> 125 | token = await Web3Token.sign(
| ^
Please advise.
I am getting this same error. @bytesbay can you please provide better typescript support? Thank you!
In the meantime I suggest going:
import * as Web3Token from "web3-token";
import { sign } from "web3-token";