Skip to content
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

Create a compiler replacement similar to tsc-silent for full ts compiler support #14

Open
nwetzel22 opened this issue Mar 6, 2023 · 4 comments

Comments

@nwetzel22
Copy link

I seem to be running into a few use cases where a tsc.js replacement may be necessary. For example, I'd like to use the --watch option, which I can't seem to integrate with loose-ts-check with a pipe operator. The tsc-silent project does this so I'm considering writing another tool base of off tsc-silent but its able to read in outputs from loose-ts-check. Any thoughts on this?

@Gelio
Copy link
Owner

Gelio commented Mar 7, 2023

Thanks for another issue. The problem with using loose-ts-check in a shell pipe is the lack of support for stream processing (#4). For it to even have a chance to work, we would have to implement the "Parsing errors one-by-one" variant. Then, I imagine we would use tsc --watch | loose-ts-check.

Using tsc --watch | cat is almost the same as just tsc --watch, just the colors are gone. This gives me this approach with loose-ts-check would work assuming the CLI does not wait for its stdin to be closed before it starts processing errors.

Let me know if you have other ideas how to get it to work with --watch mode, or if you have other use cases for which wrapping tsc inside loose-ts-check would be a must.

Personally, I'd prefer to only parse the output of tsc and not integrate loose-ts-check with it directly

Also, TIL about https://github.com/evolution-gaming/tsc-silent. I probably wouldn't have created loose-ts-check knowing tsc-silent exists. Both tools seem to do the same thing, as far as I can tell

@nwetzel22
Copy link
Author

nwetzel22 commented Mar 7, 2023

Thanks for the reference to #4. I like the sound of that. I think I might try to implement it. I went down the path of tailoring tsc-silent to work with loose-ts-check outputs. I have it working locally. However, I agree that parsing tsc output would be optimal. The tsc-silent package is great but probably a bit more prone to version errors as it recreates some internal tsc logic.

A few reasons I went with loose-ts-check over ts-silent:

  1. loose-ts-check generates outputs whereas tsc-silent requires manual configuration. I prefer the former because it makes it easier to maintain the list of files/errors and prevents silencing of errors for new files going forward.
  2. I wanted to avoid recreating logic with the tsc codebase.
  3. tsc-silent seems to be fairly dormant and I had trouble running it as is.
  4. I didn't know I would want/need the --watch option until yesterday.

One thing I do like about tsc-silent, though is that it allows for file/code pairs so that certain codes can ignored in certain files. I haven't needed this feature yet, but it sounds like it could be useful.

I'll see if I can get something working based on #4. Thanks again for the suggestion.

@Gelio
Copy link
Owner

Gelio commented Mar 7, 2023

Thanks for listing the reasons you went with loose-ts-check -- I appreciate it 👍

One thing I do like about tsc-silent, though is that it allows for file/code pairs so that certain codes can ignored in certain files. I haven't needed this feature yet, but it sounds like it could be useful.

I totally agree, it would be nice to be able to target some error codes just in particular files. That would be yet another issue we could work on

I'll see if I can get something working based on #4. Thanks again for the suggestion.

Awesome! Let me know if you need help

@nwetzel22
Copy link
Author

I think I have #4 working with the ability to handle tsc -w. I need to write and verify some test and then I'll push up a PR for your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants