I am still suffering from the issue described in microsoft/TypeScript#32970
I that issue I provided a repro and that repro was resolved by microsoft/TypeScript#33567
However in my actual application I still face the original issue described (the repro was intentionally simplified). Get error TS2742: The inferred type of 'actions' cannot be named without a reference to 'drive-common/node_modules/typescript-fsa'. This is likely not portable. A type annotation is necessary. when using yarn link to link packages for dev.
I have updated my original repro to re-expose the problem. Follow steps below...
clone https://github.com/simonfox/repro-plugin-one
clone https://github.com/simonfox/repro-plugin-two
run yarn for both
run yarn link in plugin two root
run yarn link plugin-two in plugin one root
you will see the issue in src/features/feature-one/actions.ts (you may need to reload the VS Code window after linking).
cc @sheetalkamat
I will refer my closed issue as related here. It seems to be the same problem: #33137
Lastly I've discovered this may happens even inside node modules (when there are more than one package that depends on another module (C) in different major versions).
TypeScript compiler cache is not handling NodeJS module resolution described in:
I also think that the pull request #33567 is a close approach to the solution.
@imt-jaime
Lastly I've discovered this may happens even inside node modules (when there are more than one package that depends on another module (C) in different major versions).
That's pretty much what happens to me. It's an issue even when the packages are not linked, just being a dependency already triggers this. Also, it doesn't have to be a major version difference, any version difference causes the issue.
@imt-jaime
Lastly I've discovered this may happens even inside node modules (when there are more than one package that depends on another module (C) in different major versions).
That's pretty much what happens to me. It's an issue even when the packages are not linked, just being a dependency already triggers this. Also, it doesn't have to be a major version difference, any version difference causes the issue.
You're right, it is a different problem. @simonfox Have you tried to set 'preserveSymlinks' true in tsconfig.json?
I think the problem in your case is you're not specifying to TypeScript that you want to resolve dependencies with relative paths.
You can find more information in official documentation
@imt-jaime preserveSymlinks does not resolve the issue
If anyone find this issue, it seems fixed on the next package today :)
I'm still having this issue even when using typescript 3.9.x. I'll set up a repository to make it easier to simulate the problem.
Most helpful comment
If anyone find this issue, it seems fixed on the
nextpackage today :)