I wrote a script using ts.createWatchCompilerHost and with visitors im modifying emits and for first one it works great but when i save second time my edit from last time affects results. For example when i see @CustomElement decorator i delete that decorator and emit some lines of code. Next time that file compiles with watch since that decorator is deleted neither code i actually try to emit works or decorator comes back to me. I'm curious whats right way for this kind of edits.
I wrote a script using ts.createWatchCompilerHost and with visitors im modifying emits and for first one it works great but when i save second time my edit from last time affects results. For example when i see @CustomElement decorator i delete that decorator and emit some lines of code. Next time that file compiles with watch since that decorator is deleted neither code i actually try to emit works or decorator comes back to me. I'm curious whats right way for this kind of edits.
Deleting decorator from decorator array
Updating emited code / class
I cut some unrelated parts if some things look unnecessary its probably because of this.