sometimes typescript will fail if there are 2 duplicate packages in the workspace node_modules. this can happen in pnpm if a package is usedin 2 different places (even if inside a node_module package, transitive dependency) with a different set of versions for a peer dependency
for example if better-auth depends on zod peer dep and zod is in different versions in 2 dependency subtrees
to identify if a pnpm package is duplicated search for the string " packagename@" inside pnpm-lock.yaml
, notice the space in the search string. Then if the result returns multiple instances with a different set of peer deps inside the round brackets it means that this package is being duplicated. Here is an example of a package getting duplicated: