Referencing types in monorepo in sibling directory (going below root)

Would someone know how to help to solve a problem of referencing types in a TypeScript monorepo project? Or if it is even possible in the following setting.

The structure is like

.
├── tsconfig.json
├── lib/
│   └── workers/
│       ├── types.ts
│       ├── hello.ts
│       └── tsconfig.json
└── frontend/
    ├── tsconfig.json
    └── openwcMiniflare.ts

where frontend/tsconfig.json references types like import { WorkerMethods, WorkerEvents } from 'workers/types'; with configuration such as (relevant parts, full source here)

{
  "compilerOptions": {
    "composite": true,
    "baseUrl": ".",
    "outDir": "./out-tsc",
    "sourceMap": true,
    "rootDir": "./",
    "paths": {
      "workers/*": ["../lib/workers/*"]
    },
  }
  "references": [
    { "path": "../lib/workers" }
  ]
}

workers/types.ts

export type WorkerMethods = {
  sum: (x: number, y: number) => number;
  mul: (x: number, y: number) => number;
};

export type WorkerEvents = {
  ping: string;
};

I don't understand how VS Code gives the following error message and indeed, it looks like the types are undefined during runtime.

enter image description here

BUT! If I change the definition like import { WorkerMethods, WorkerEvents } from '../../lib/workers/types';, then error message tells they're outside of rootDir.

Is structure like this even possible with VS Code?


Well! This is embarrassing, also a bit strange. This configuration does in fact work after I cleaned up node_modules and lock files. I have no idea what could have been the problem and if the cause was about this or doing this cleaning just contributed in such a way the solution works.

In any event, if/when someone looks into this issue, that configuration should work (remembering the usual tsc --build on composite projects and tsc --project <directory>\tsconfig.json or a combination thereof).