gustavopch / tsc-files

A tiny tool to run `tsc` on specific files without ignoring tsconfig.json
MIT License
234 stars 49 forks source link

Strange results where all files are being typechecked and type errors don't make sense #52

Closed mikepianka closed 1 year ago

mikepianka commented 1 year ago

Hey, thanks for the great tool! I have been using it successfully with lint-staged but have been hitting some strange issues lately seemingly out of nowhere. First, if I stage a single file, lint-staged correctly says there is 1 file staged but tsc-files will find a bunch of type errors in unrelated files. If I go check out these type errors in VS Code, there does not actually seem to be an issue. If I run npx tsc --noEmit on my entire src directory I don't get these errors so I am not really sure what the deal is.

For example, in the image below I purposefully made a type error in App.tsx and staged the file. That one gets correctly flagged, but then a bunch of other files get flagged like MJ4D.tsx. If I go in MJ4D.tsx and check out that id param there is no type error there. A normal invocation of tsc doesn't return these type errors.

image

gustavopch commented 1 year ago

Probably because ambient declarations are not loaded automatically. Check https://github.com/gustavopch/tsc-files/issues/20.

mikepianka commented 1 year ago

Thanks will do