Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
Importing a JS module in a Typescript file

I am developing a website in TS in which I have to call an unofficial API, that is https://www.npmjs.com/package/reverso-api. The whole module is written in JS, and as described in the docs, the proper way to import the module in JS is

const Reverso = require('reverso-api');
const reverso = new Reverso();

Unluckily, I am developing in TypeScript. I have no idea how to import the module in my project in order to make it works. How can I do that?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If this package doesn't have a type definition, you can use a temporary shorthand declaration so TypeScript won't yell at you. This makes all imports from reverso-api have any type, which you might have guessed is not very safe, but it's all we have right now.

declare module 'reverso-api';

Reference: https://www.typescriptlang.org/docs/handbook/modules.html#shorthand-ambient-modules

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!