I'm trying to run this script
const fetch = require('node-fetch');
function test() {
fetch('https://google.com')
.then(res => res.text())
.then(text => console.log(text))
}
test();
But i get this error
This expression is not callable. Type 'typeof import("(...)/node_modules/node-fetch/@types/index")' has no call signatures.ts(2349)
although it works when i use import
import fetch from 'node-fetch';
why and how to fix it?