-
Notifications
You must be signed in to change notification settings - Fork 189
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
Calling .remove()
removes comment which shouldn't be removed
#336
Comments
Hi @donaldpipowitch, yes this is a bug and thanks for reporting this! That comment is not owned by the interface. In the beginning of this library comments were an afterthought so there are still a few areas like this that aren't correct. |
@dsherret - just in case, this is the difference between ts.Node getText vs getFullText - and the same for other methods like getStart() getFullStart() getFullWidth(), etc - if internally the library use "Full" methods instead of non full then those trailing comments (tribia content as they call it) will be considered. - if not it will be discarded. My two cents. |
@cancerberoSgx thanks, but no it's not related to that. I fixed a similar issue to this before so I'll have this fixed soon. |
Fixed in 11.2.2. Let me know if you run into any other issues. |
This is awesome. I'll test it. Thank you very much for the quick fix and the release. |
Hi there! This is my first try to use
ts-simple-ast
. We would like to convert certain interfaces to types. But in some cases "trailing" comments are removed and we don't know why.Given the following example:
The output is this:
As you can see the comment
// foo
was removed. I wonder why? When I paste the same example to https://astexplorer.net/ with TypeScript selected as the parser it shows that the comment is not a trailing comment ofinterface Foo
, but a leading comment toconst foo = 1;
.So is this a bug that the comment will be removed when
myInterface.remove();
is called?Thank you.
The text was updated successfully, but these errors were encountered: