#Same type from 2 packages are somehow not the same

16 messages · Page 1 of 1 (latest)

carmine chasm
#

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.

carmine chasm
carmine chasm
#

Okay the issue seems to be related to these 2 settings

"moduleResolution": "bundler",
"module": "esnext"
carmine chasm
#

Minimized this even further, no more nx or even workspaces

woven idol
#

Can you reproduce with out pnpm? I've had seen some weird pnpm related issues in the past.

carmine chasm
#

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

carmine chasm
#

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

#

😔

carmine chasm