Skip to content

fix(54465): Broken emit with private field in class decorator #54679

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

Merged
merged 5 commits into from
Jun 23, 2023

Conversation

a-tarasyuk
Copy link
Contributor

@typescript-bot typescript-bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Jun 16, 2023
@rbuckton
Copy link
Contributor

I think what we should be looking at is lookupSymbolForPrivateIdentifierDeclaration. Right now it just uses getContainingClass(location) which does not skip over the immediately containing class of a class decorator.

We need something more like:

function getContainingClassExcludingClassDecorators(node: Node) {
  const decorator = findAncestor(node.parent, n => isClassLike(n) ? "quit" : isDecorator(n));
  if (decorator && isClassLike(decorator.parent)) return getContainingClass(decorator.parent);
  return getContainingClass(decorator ?? node);
}

Which would then replace the first getContainingClass call in lookupSymbolForPrivateIdentifierDeclaration.

…rs. handle undefined private identifiers in plain JavaScript files
@a-tarasyuk a-tarasyuk requested a review from rbuckton June 23, 2023 15:07
@rbuckton rbuckton merged commit de6e6ab into microsoft:main Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken emit with private field in class decorator
4 participants