Typescript: Better error message for missing member in tslib

Created on 25 Sep 2019  ·  8Comments  ·  Source: microsoft/TypeScript

@amcasey brought this up while upgrading Yammer to 3.6/3.7.

This syntax requires an imported helper named '__spreadArrays', but module 'tslib' has no exported member '__spreadArrays'.

The error message tells us something that is technically correct, but which is not clearly actionable. The user has no idea why __spreadArrays gets imported during an upgrade.

We should indicate that the user should try upgrading tslib.

This syntax requires an imported helper named '__spreadArrays' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
Error Messages Experience Enhancement Fixed Suggestion good first issue help wanted

Most helpful comment

Thanks!
Upgraded to 1.10.0 and all ok.

My error had been for ionic / cordova and the android logcat error was:

"Uncaught TypeError: tslib.__spreadArrays is not a function"

All 8 comments

@DanielRosenwasser did upgrading tslib fix the error?

@m-henderson yep.

@amcasey @DanielRosenwasser it looks like there are a lot of places that the message is referenced:
Screen Shot 2019-09-26 at 1 30 21 PM

Are we going to want to recommend a tslib upgraded on every instance of the message or only when tslib as no exported member of _spreadArrays ?

It should just be a matter of updating the message in diagnosticMessages.json, running gulp generate-diagnostics, updating the place where the error is issued in src, and accepting new error message baselines. Please check out our CONTRIBUTING.md at the root of the repo.

@DanielRosenwasser I opened a PR. Just let me know if any changes need to be made to it and I will take care of it.

https://github.com/microsoft/TypeScript/pull/33625

Thanks @m-henderson!

@DanielRosenwasser no problem! thank you for helping me out with the detailed comment :

It should just be a matter of updating the message in diagnosticMessages.json, running gulp generate-diagnostics, updating the place where the error is issued in src, and accepting new error message baselines. Please check out our CONTRIBUTING.md at the root of the repo.

Thanks!
Upgraded to 1.10.0 and all ok.

My error had been for ionic / cordova and the android logcat error was:

"Uncaught TypeError: tslib.__spreadArrays is not a function"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

kyasbal-1994 picture kyasbal-1994  ·  3Comments

dlaberge picture dlaberge  ·  3Comments

Zlatkovsky picture Zlatkovsky  ·  3Comments

siddjain picture siddjain  ·  3Comments

fwanicka picture fwanicka  ·  3Comments