You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Locally we have this package at the same version, but with an additional type:
exporttypeA1=number;exporttypeA2=string;
Locally we also have a package b, that has a dependency on a released version of a@1.0.0 and exports the following type:
import{A1}from"a";exporttypeB=A1;
Finally, locally we also have a package c, that has dependencies on local workspace versions of packages b and a and imports types from them both:
// Switching order of these import fixes the buildimport{B}from"b";import{A2}from"a";constb: B=1;consta2: A2="a2";
π Actual behavior
When building package c, the build fails with error:
> c@1.0.0 build
> tsc
src/index.ts:3:10 - error TS2305: Module '"a"' has no exported member 'A2'.
3 import { A2 } from "a";
π Expected behavior
When building package c, TypeScript resolves package a to our local version which does have the A2 type, and the build succeeds.
Additional information about the issue
I tried running tsc -traceResolution for package c and it seems that both - released package and the local one - are assigned the same Package ID:
...
======== Resolving module 'a' from 'E:/temp/ts-deps-issue/packages/c/src/index.ts'. ========
...
======== Module name 'a' was successfully resolved to 'E:/temp/ts-deps-issue/packages/a/lib/index.d.ts' with Package ID 'a/lib/index.d.ts@1.0.0'. ========
======== Resolving module 'a' from 'E:/temp/ts-deps-issue/packages/b/lib/index.d.ts'. ========
...
======== Module name 'a' was successfully resolved to 'E:/temp/ts-deps-issue/node_modules/.pnpm/a@file+packages+a+a-1.0.0.tgz/node_modules/a/lib/index.d.ts' with Package ID 'a/lib/index.d.ts@1.0.0'. ========
...
I suppose that could cause a cache collision or something like that.
The text was updated successfully, but these errors were encountered:
π Search Terms
"local module resolution", "module resolution same version"
π Version & Regression Information
5.6.3
, also reproduced withnext
,4.6
,4.8
,5.0
.β― Playground Link
https://github.com/grigasp/ts-deps-issue
π» Code
Package
a@1.0.0
is released with the following:Locally we have this package at the same version, but with an additional type:
Locally we also have a package
b
, that has a dependency on a released version ofa@1.0.0
and exports the following type:Finally, locally we also have a package
c
, that has dependencies on local workspace versions of packagesb
anda
and imports types from them both:π Actual behavior
When building package
c
, the build fails with error:π Expected behavior
When building package
c
, TypeScript resolves packagea
to our local version which does have theA2
type, and the build succeeds.Additional information about the issue
I tried running
tsc -traceResolution
for packagec
and it seems that both - released package and the local one - are assigned the same Package ID:I suppose that could cause a cache collision or something like that.
The text was updated successfully, but these errors were encountered: