-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Description
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
.
🔎 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,
intsconfig.json
- create file
index.ts
and addexport * 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.