Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential regression in 4.5.2: 'tslib' cannot be found #46953

Closed
ASDFGerte opened this issue Nov 30, 2021 · 2 comments
Closed

Potential regression in 4.5.2: 'tslib' cannot be found #46953

ASDFGerte opened this issue Nov 30, 2021 · 2 comments

Comments

@ASDFGerte
Copy link

Bug Report

I am getting a

This syntax requires an imported helper but module 'tslib' cannot be found. ts(2354)

when using export * from './other' in TS 4.5.2, and downgrading to TS 4.4.4 solves it. This is with yarn 3.1.0 and pnp, but apparently someone else could observe the same problem without pnp (can't verify). The error first hits me as a red mark in vscode, and also occurs when running tsc. I did not test, whether the problem exists with a plain setup using npm.

error

🔎 Search Terms

Searching for the related error message yields a great many issues and articles, but all i could find were either resolved, or i couldn't be sure, whether it's the same. I'd not be surprised, if there was some issue for this i couldn't find. There is e.g. #46288 which however is closed, and the related change appears merged already.

🕗 Version & Regression Information

As mentioned, the problem starts happening in 4.5.2, and doesn't occur in 4.4.4. I could not properly test nightlies, as there is no yarn patch for it yet.

💻 Code

Repo: https://github.com/ASDFGerte/tstest need to run yarn install, and either allow vscode to use the project's TS version, or somehow run the tsc supplied by the integration. I did not test, whether this also happens without yarn.

Manual reproduction (as nothing complex is necessary):

  • create folder
  • open with vscode
  • yarn init -y
  • yarn set version berry
  • yarn add -D typescript
  • yarn add tslib
  • yarn dlx @yarnpkg/sdks vscode
  • yarn tsc --init
  • uncomment "importHelpers": true, in tsconfig.json
  • create file index.ts and add export * from ''; (note: from what i could see, whether the file for the re-exported module exists or not doesn't matter for showing the error, it will just additionally show the "Cannot find module ''" error. You can add the other file if wanted, it's also in the repo above)
  • allow vscode to use the project's ts version (either by the automatically appearing box in the lower right, or by >Typescript: Select Typescript Version... and selecting the workspace one

Setting the ts version from ^4.5.2 to 4.4.4 in package.json, followed by a yarn install and vscode command >Developer: Reload Window (or reloading TS, restarting vscode, ...) removes the error.

🙁 Actual behavior

error

🙂 Expected behavior

no error, as has been for a long time, or some minor setting change i can do to fix the error, if there was a breaking change.

@MartinJohns
Copy link
Contributor

MartinJohns commented Nov 30, 2021

Duplicate of #46874, which mentions yarnpkg/berry#3722, where they mention it's been fixed with Yarn 3.1.1. You should update your Yarn version.

In general there's no official support for pnp, so any issue is likely on the side of Yarn / pnp (afaik they hacked in a support). You might want to follow #28289.

@ASDFGerte
Copy link
Author

ASDFGerte commented Nov 30, 2021

Thanks, upgrading to yarn 3.1.1 indeed solves the issue. There was a small problem with yarn, that caused 3.1.1 to not be downloaded immediately with yarn set version berry, which is fixed by now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants