Troubleshooting TypeScript Build Error with Effect Schema and Branded Types in a PNPM Workspace

hi all 👋

i am trying to use effect schema and Branded types. my current setup is

- packages/lock/ - "core library"
- packages/manager/ - "uses lock"
- pacakges/generator/ - "uses lock"

i wire together projects using pnpm workspaces and typescript references (i.e. each library has a separate tsconfig.json file with composite: true and declaration: true).

When I try to build lock or import it, however, I get the following error.

packages/lock build$ tsc -p tsconfig.build.json
│ src/lock.ts(35,7): error TS2742: The inferred type of 'LOCK_SCHEMA' cannot be named without a reference to '.pnpm/effect@2.4.15/node_modules/effect/Brand'. This is likely not portable. A type annotation is necessary.

Any idea how I could fix this? I'd also happily create a reproduction repository if this is a new issue.
Was this page helpful?