I'm encountering a problem with VSCode and TypeScript related to auto imports.
Our application includes a service known as Manager, which relies on certain functions imported from a private npm package called Helpers. Both Manager and Helpers make use of types imported from another private package named Types.
Usually, when I make changes to Types locally, I add them and then link Types in Manager using npm so that the new types can be accessed without having to publish the Types package (I have successfully done this in previous projects without any issues).
However, here comes the issue ... after creating the symlink, the import statement
import {newType} from '@companyName/Types'
resolves to node_modules/@companyName/Helpers/node_modules/Types
, and no matter what I try, it continues to point to that location.
Initially, I thought this was an problem with VSCode. Yet, if I restart the TypeScript server, there is a brief moment where it correctly references the package path and VSCode recognizes the type. However, after a few seconds (presumably once the TS server restarts), an error appears, and we revert back to importing from the incorrect location.
One workaround is to use a relative import path within node_modules, but this solution seems less than ideal.
Does anyone have any insights into what might be causing this issue? It seems like TypeScript is reluctant to utilize a symlinked import if it can find the module elsewhere.