cevek / ttypescript

Over TypeScript tool to use custom transformers in the tsconfig.json
1.53k stars 56 forks source link

Filter diagnostics #99

Closed Exeteres closed 4 years ago

Exeteres commented 4 years ago

I need to filter diagnostic messages after code emit. I managed to filter them in VSCode using language service plugin and now I am trying to suppress this errors in ttsc output. Firstly, I tried to patch the emit method of program provided to the transformer factory, but it does not work. I also can't patch any function like emitFilesAndReportErrorsAndGetExitStatus, possibly because ttypescript passes to tsc another ts instance. Any thoughts?

nonara commented 4 years ago

ttypescript isn't built with that functionality. You can accomplish that with ts-patch, however.

Exeteres commented 4 years ago

@nonara I know about ts-patch. I was using it's program replace feature. And I also know about the ability to alter diagnostics. I will use ts-patch as a workaround, but I see no problems to implement this functionality in ttypescript. Honestly, I think that ttypescript way of patching typescript on the fly is much cleaner than patching typescript on the filesystem. But if for some reason this feature cannot be implemented in ttypescript, I will replace ttypescript with ts-patch in the existing code bases.

nonara commented 4 years ago

The logic is compatible, but I'm not a maintainer, so I cant speak to whether a PR for that feature would be accepted.

For what you're looking to do, you'd probably need to fork and migrate the logic or just use ts-patch. Good luck with it!

cevek commented 4 years ago

Sorry, but filtering diagnostics is not goal for this project. Use native typescript plugin system instead.