I have setup a monorepo with nx and have 2 relevant packages invovled here. One package exports a function which returns data of type Selection from the prosemirror-state package. The other package depends on this earlier package, when using the function the returned data cannot be assigned to a local variable of type Selection from the same prosemirror-state package. The dependency versions match on both local packages as well. (1.4.3) The second package is a React library using vite as the bundler.
#Same type from 2 packages are somehow not the same
16 messages · Page 1 of 1 (latest)
Created a reproduction here: https://github.com/VimHax/TS1360-Reproduction
Okay the issue seems to be related to these 2 settings
"moduleResolution": "bundler",
"module": "esnext"
Minimized this even further, no more nx or even workspaces
Can you reproduce with out pnpm? I've had seen some weird pnpm related issues in the past.
the error still seems to persist, I deleted out the node_modules folder and ran npm i and then ran npm run typecheck (didn't delete pnpm-lock.yaml but I don't think that's necessary since a package-lock.json was generated by npm)
it's probably some mistake in the tsconfig files but can't figure it out so far
explicitly adding
"paths": {
"prosemirror-state": ["./node_modules/prosemirror-state/dist/index.d.ts"]
}
seems to fix the issue
I guess that works? but damn that's ugly... gonna try to see if there's something I can do to perhaps nudge the compiler to find the path automatically or something
this issue seems to be a bug in the compiler, https://github.com/microsoft/TypeScript/issues/57553
running the repro with --traceResolution
======== Module name 'prosemirror-state' was successfully resolved to '/project/workspace/project-state/node_modules/prosemirror-state/dist/index.d.ts' with Package ID 'prosemirror-state/dist/index.d.ts@1.4.3'. ========
======== Module name 'prosemirror-state' was successfully resolved to '/project/workspace/project-state/node_modules/prosemirror-state/dist/index.d.cts' with Package ID 'prosemirror-state/dist/index.d.cts@1.4.3'. ========
the same package seems to be getting resolved in 2 different ways
😔
https://github.com/microsoft/TypeScript/issues/57553#issuecomment-3443782599 this has been confirmed and therefore closing this