-
Notifications
You must be signed in to change notification settings - Fork 55
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
.guard.ts files are created in imported packages #146
Comments
Hey, sorry for the slow response. I think I typed something then forgot to hit send. Yes, this is obviously a bug. AFAIK this should only be looking at files in the current project. Are you sure you're not using any Either way an empty file should never be created. I will accept a PR to fix this. Let me know if you need any help. |
Oof. I made a local copy of Using a file url will copy over the The observable difference is that I spent hours trying to figure out which difference in dependencies leads to the different results, but got nowhere. Instead, I reproduced the bug in a minimal example with the latest ts-morph, and filed an issue with them: dsherret/ts-morph#1172 If that gets fixed upstream, ts-auto-guard would have to upgrade to ts-morph 11. Their breaking-changes don't list anything suspicious, and the upgrade seems to work fine without code changes, but some of the testcases break. Were you planning such an upgrade? Otherwise I doubt this bug is fixable.
Then that's a separate bug. Even without the symlink shenanigans, running ts-auto-guard on a file without exported types will create empty files. |
@cauthmann thank you so much for your investigation and for filing the upstream error. I've invited you on as a collaborator as you're already contributing to the project IMO. I'm not actively working with TS at present (and am very busy elsewhere) but will keep an eye out and am happy to review PRs or answer questions. |
Uh, this issue might have been fixed along with #147. Will need to check before closing this one. |
Hello,
Using v1.0.0-alpha.24.
I'm using a yarn monorepo, with two packages, in a directory structure similar to this:
package-b has a dependency on package-a. On yarn/linux this creates a symlink to
../package-a
innode_modules
.If I run
ts-auto-guard
on package-b, it will create .guard files in package-a.Steps to reproduce:
observe the generated files:
The first file should not have been created.
package-b
doesn't even import any types frompackage-a
.The file in
package-a
is created with or without--export-all
(it's just empty without).There seems to be a check whether the file is inside
node_modules
, whichpackage-a/index.ts
is not (due to the symlink - if I copy the directory over, replacing the symlink, no files are generated).As a possible solution, it could also check whether the file is in the current project's directory, e.g. below the relevant
tsconfig.json
.The text was updated successfully, but these errors were encountered: