Remove d.ts & .js files on branch switching (TS)

Hey, big fan of webstorm but I've had an issue which is frustrating and hope there is away around it.

 

I noticed when switching branches, and whilst I have `npm run watch` running, threre are leftover d.ts & .js files where the .ts file from the other branches where. I'm having to manually delete the d.ts & .js files in order to get my build of the branch I'm on working. Also running `npm run build` is resulting in the same issue.

Is there any way around this?

0
3 comments

Not sure I follow you.. Please could you provide the detailed steps that reproduce the issue? Do you run your scripts/switch branches from within the IDE? Are the .js/.d.ts files produced by your build scripts?

0

Yes Elena Pogorelova

 

Right now I am working on a branch which has the following file (downloadImageStoreInS3.ts):

Whilst working on this branch, everything is ok when running npm run watch or npm run build.

 

If I switch to a branch which downloadImageStoreInS3.ts is not in, I still have the downloadImageStoreInS3.d.ts & downloadImageStoreInS3.js files but no downloadImageStoreInS3.ts file. Running npm run watch or npm run build is resulting in errors.

 

Is there a way for when i am switching branches or delete a .ts file, for the d.ts or .js file to also be removed?

0

>Is there a way for when i am switching branches or delete a .ts file, for the d.ts or .js file to also be removed?

When deleting the .ts file, the IDE usually prompts you if you like to delete the generated files:

But changing branches does not touch/change/remove unversioned files, this is a normal Git behavior....

0

Please sign in to leave a comment.