-
Notifications
You must be signed in to change notification settings - Fork 195
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
Unable to rename a property to a PrivateIdentifier #1198
Comments
@TimvdLippe could you post some reproduction code? The source file in that example has empty text. Renaming to a private property works for me in a scenario I just tried out. Also, it looks like what's failing in that example is that the |
@dsherret Ah apologies, I didn't know you could write the contents of the test file there. Running the above script fails with the following error:
|
Oh, sorry if I was unclear. I updated the original issue comment with a reproduction case, where it uses 2 private identifiers where it crashes on the second refactoring. |
Thanks @TimvdLippe! This is definitely a bug. Will be fixed in the next release (I will probably do one today) |
Describe the bug
Version: 12.0.0
To Reproduce
Expected behavior
A property that was
private someProperty: string
gets renamed to#someProperty:string
Actual behavior
ts-morph
crashes when analyzing the second property to rename. E.g. it successfully renames the first property in a class, but then when it processes the second property in a class it fails with the following exception:As a workaround, I currently use a specific prefix and then I manually replace
SOME_UNIQUE_PREFIX
with#
in my editor.Ideally
property.rename
can accept not just astring
but also anIdentifier
Node that we can then pass in aPrivateIdentifier
node.The text was updated successfully, but these errors were encountered: