-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: parse newer tsc format and strip ansi colors #20
base: master
Are you sure you want to change the base?
Conversation
Hey, thanks for the contribution and bringing up these issues! I haven't tested loose-ts-check with newer TS versions, and it makes sense to do that. I will probably review it over the upcoming weekend. Regarding ANSi colors in the output, I'm surprised |
Ah, you're right, I do have pretty enabled in |
Yup, I agree, the tool should handle that case too. Thanks for checking |
Sorry, it took me a while to get to this PR. Unfortunately, as I see, the tests are failing. It's not only the formatting differences reported by prettier in CI, but there is a unit test that fails when I run it locally. As for adding this contribution, let me know if you prefer to give you feedback via PR comments, or take over the PR and incorporate it into the codebase myself, with you still appearing in the list of contributors. |
From my research, it looks like this TS error format you're experiencing is nothing new in TypeScript. TypeScript uses this format when Invoking the following on TS 5.3.2: npm run type-check -- --pretty | pbcopy (which ran
The output contains both ANSI colors codes and the format is different. However, when I remove the at 19:10:56 ❯ npm run type-check | cat
> loose-ts-check@2.0.0 type-check
> tsc
src/tsc-errors/parse-tsc-errors.ts(9,39): error TS2304: Cannot find name 'tscErrorLineRegExp'. I got the same results on TS 4.9.4. This lowers the severity and urgency of this PR. This becomes a "parse TS |
@Gelio I think it's best if you take over as I don't have enough time to contribute more or in depth knowledge on the underlying issue - as your investigation shown it seems that's more of an addition rather than bug fix and it's up to you if you want to add |
Sure thing, makes sense to add the information about |
This is a basic workaround to address two issues:
tsc
output includes colors which makes lines non-matchingtscErrorLineRegExp
-> sanitize inputtsc
output has different format than expected (I'd assume newer version oftsc
, I'm currently using5.2.2
) -> extendtscErrorLineRegExp
with match for an alternative formatMy
tsc
error output looks as follows: