Visual Studio logo

How to fix Visual Studio throwing a “This syntax requires an imported helper named ‘__spreadArray’ which does not exist in ‘tslib’. Consider upgrading your version of ‘tslib’.

This post was most recently updated on July 27th, 2022.

2 min read.

This one is something that I keep running into. Visual Studio just throws an error for a missing helper __spreadArray in a library that you didn’t even know you had installed, and you’re not sure if it should – or even can – be updated.

I guess Visual Studio just refuses to give me a break :) But like with so many different issues, there are multiple fixes available!

Problem

So when trying to build your solution or start debugging in Visual Studio, you run into an error somewhat like this:

TS2343	(TS) This syntax requires an imported helper named '__spreadArray' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.

What do?

Solution

Okay, so check out the steps below!

Time needed: 1 minute

Fixing “This syntax requires an imported helper named ‘__spreadArray’ which does not exist in ‘tslib’. Consider upgrading your version of ‘tslib’ in Visual Studio

  1. Ignore the error

    Just ignoring the error might work. There’s a non-zero chance that the error won’t actually stop you from building and debugging.

    If actually DOES fail your build, proceed.

  2. Clean your solution and rebuild

    If cleaning and rebuilding your solution still doesn’t help, well, there are more steps below.

  3. Restart Visual Studio

    This sounds stupid, but it might help – and even if it doesn’t, restarting Visual Studio is reasonably quick to do. Nowadays, anyway.

  4. Update your tslib

    Updating your tslib version might be helpful if you’re using an older version than 1.10.0. You should probably be running something more recent than that, as it was published sometime in 2019 :)

  5. Just reinstall the package

    Ok, so if everything else fails, this has worked for me every single time.

    Just run the command below:
    npm install tslib@latest --save

    Or if you actually know which version you want to use, run it like this:
    npm install tslib@[your-preferred-version]latest --save


Et voilà !

Did it help or not?

mm
5 6 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments