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

Combining importHelpers: true and module: preserve results in TS2354 #57688

Closed
jgoz opened this issue Mar 8, 2024 · 1 comment · Fixed by #58451
Closed

Combining importHelpers: true and module: preserve results in TS2354 #57688

jgoz opened this issue Mar 8, 2024 · 1 comment · Fixed by #58451
Assignees
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.

Comments

@jgoz
Copy link

jgoz commented Mar 8, 2024

🔎 Search Terms

TS2354 This syntax requires an imported helper but module 'tslib' cannot be found.
importHelpers
module
preserve

🕗 Version & Regression Information

Occurs in 5.4.2 and in ^5.5.0-dev.20240307.

  • This changed between versions 5.3.3 and 5.4.2

^ This is not technically true because "module": "preserve" wasn't added until 5.4.2.

⏯ Playground Link

https://github.com/jgoz/typescript-module-preserve-issue

💻 Code

export class Foo {
  #foo: boolean;

  constructor() {
    this.#foo = false; // This syntax requires an imported helper but module 'tslib' cannot be found. ts(2354)
  }

  foo(): boolean {
    return this.#foo;
  }
}
{
  "compilerOptions": {
    "moduleResolution": "bundler",
    "module": "preserve",
    "importHelpers": true,
    "outDir": "dist",
    "target": "es2021"
  }
}

🙁 Actual behavior

Error message indicates that tslib is not present, but it is.

🙂 Expected behavior

No error.

Additional information about the issue

Not sure if this is a TS issue or an issue with the export maps in tslib.

@andrewbranch
Copy link
Member

Have a fix on the way from the report at #58325

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants