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

Regression in [email protected] when using private fields i.c.m. with ESM #207

Closed
nicojs opened this issue May 30, 2023 · 3 comments
Closed

Comments

@nicojs
Copy link

nicojs commented May 30, 2023

Input:

export class File {
  #relativePath: string = "";
  constructor(name: string) {
    this.#relativePath = name;
  }

  get relativePath() {
    return this.#relativePath;
  }
}

With settings:

{
  "compilerOptions": {
    "module": "Node16",
    "target": "es2022",
    "moduleResolution": "Node16",
    "esModuleInterop": true,
    "outDir": "dist",
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true,
    "importHelpers": true,
  }
}

And { "type": "module" } in package.json

Results in these error:

src/main.ts:4:5 - error TS2343: This syntax requires an imported helper named '__classPrivateFieldSet' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.

4     this.#relativePath = name;
      ~~~~~~~~~~~~~~~~~~

src/main.ts:8:12 - error TS2343: This syntax requires an imported helper named '__classPrivateFieldGet' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.

8     return this.#relativePath;
             ~~~~~~~~~~~~~~~~~~

Reverting to tslib 2.5.0 resolves these issues.

See: tslib-issue.zip

@andrewbranch
Copy link
Member

Duplicate of #203, 2.5.2 was already published

@andrewbranch andrewbranch closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2023
@nicojs
Copy link
Author

nicojs commented May 30, 2023

This is not a duplicate. The bug persists in v2.5.2.

Sorry I wasn't clear about that @andrewbranch 😓

@andrewbranch
Copy link
Member

andrewbranch commented May 30, 2023

See #203 (comment)

I think we have to patch TS itself for this, unfortunately

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