0

I am trying to import the tradingeconomics module onto node JS, but Visual Code is underlining that part of code saying:

"Could not find a declaration file for module 'tradingeconomics'. 'c:/Users/pc/node_modules/tradingeconomics/index.js' implicitly has an 'any' type.

Try npm i --save-dev @types/tradingeconomics if it exists or add a new declaration (.d.ts) file containing declare module 'tradingeconomics';"

I have tried to run "npm i --save-dev @types/tradingeconomics" on the console but it returns this:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2ftradingeconomics - Not found
npm ERR! 404
npm ERR! 404  '@types/tradingeconomics@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\pc\AppData\Roaming\npm-cache\_logs\2021-07-17T13_56_44_617Z-debug.log

This is code I tried to write but it isn't returning anything.

const te = require('tradingeconomics');

te.login();

data = te.getIndicatorData().then(function(data){
    console.log(data)       
});

Does anyone know how to solve this issue?

Thank you!

Martunis99
  • 21
  • 1
  • 8

2 Answers2

0

Use import { te } from 'tradingeconomics' instead of the require();

double-beep
  • 5,031
  • 17
  • 33
  • 41
Jason Landbridge
  • 968
  • 12
  • 17
0

There is no such package named @types/tradingeconomics. If the package is only showing in your NPM account, you must log in from the command line.

double-beep
  • 5,031
  • 17
  • 33
  • 41