I am fairly new to typescript so I am getting an error which say Argument of type 'unknown' is not assignable to parameter of type 'Error | null' and i can't understand why am i getting that. How do I solve this?
export function subscribeToAccount(
web3: Web3,
callback: (error: Error | null, account: string | null) => any
) {
const id = setInterval(async () => {
try {
const accounts = await web3.eth.getAccounts();
callback(null, accounts[0]);
} catch (error) {
callback(error, null);
}
}, 1000);
return () => {
clearInterval(id);
};
}