-
Notifications
You must be signed in to change notification settings - Fork 14
Gh 41788 incorrect output for esprivate with nested class in esnext #49
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
Gh 41788 incorrect output for esprivate with nested class in esnext #49
Conversation
… if target:ESNext and useDefineForClassFields:false.
…true for target esnext
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - one minor comment.
@@ -26349,6 +26350,31 @@ namespace ts { | |||
let prop: Symbol | undefined; | |||
if (isPrivateIdentifier(right)) { | |||
const lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(right.escapedText, right); | |||
|
|||
if(lexicallyScopedSymbol && (compilerOptions.target === ScriptTarget.ESNext && compilerOptions.useDefineForClassFields === false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think useDefineForClassFields === false
would be fine here. Is there a particular reason to use the raw value instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprised to see there is no lint rule or auto-formatting for if(
. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkubilayk me too.. Will fix the formatting.
About useDefineForClassFields
you are right using the defaulted value should be ok as well. I was thinking that if it's undefined
the check should not kick in. But since if it's undefined it will default to true, it's ultimately the same thing, and being consistent is better.
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add some private methods and accessor cases to this test either here on in 42458, depending on which one goes in first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect this to go in first. (FYI we will have conflict with private methods and accessors since this adds some extra messages)
Fixes microsoft#41788
Fixed as described in comment