TypeScript Type Resolution Issue in Monorepo Setup with Effect Library

I'm trying to setup Effect into a monorepo (pnpm + turbo). I have a shared TS config and few local overrides (like rootDir, outDir).

My packages (let's say "configuration") exports through the package.json:

{
  "exports": {
    "./error": {
      "types": "./dist/[...]/error.d.ts",
      "import": "./dist/[...]/error.js"
    }
  }
}


Whenever I import:
import { SystemPGError } from "@myapp/configuration/error"


SystemPGError is in fact Data.TaggedError("SystemPGError"), and the resolution is ok.

But, anytime I'll use the imported definition, let's say:
.tryPromise({
  try: () => connect(), 
  catch: (err) => new SystemPGError(err)
})


The Effect using that error will now become Effect<PoolClient, any, never>. The TS compiler is losing track of the SystemPGError type and fallback to "any".

I believe this is a matter of configuration, I just don't really know where to start the investigation. Any previous experience or idea?
Was this page helpful?