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

248
Views
How to make 4.X Typescript project compatible with older version of Typescript 3.X?

How to make package built on top of TS 4.X compatible with 3.X? Like, if you have newer version -> use new features, else -> use any or unknown or whatever is supported in older version.

Is there any possibility to use directives for that purpose?

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

0

There is no way to switch between supported and unsupported features in TypeScript.

For instance, if you have a library which is built on top of TS 4.0 with variadic tuple types there is no way to use it in a package where TS 3.0 is used.

However, you can maintain two versions of your typings: before TS4 and after TS4. For instance, take a look how lodash or react maintaince several versions of typings.

about 4 years ago · Juan Pablo Isaza Report

0

You can just use an install an older version (whatever you want it to be, example: `npm i --dev typescript@3.5.2) of typescript in your npm and try to fix the errors. Then revert the typescript version to v4 or whatever it was already.

Now your code is compatible with the designated older typescript version (just make sure the functionality of your code doesn't change while updating it).

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!