This repository reproduce the ts-bug error TS2742: The inferred type of 'Subclass' cannot be named without a reference to
Reproduction steps
# install pnpm if you dont have it
# https://pnpm.io/installation
# install packages
pnpm i
# build monorepo
pnpm --filter consumer... build
- No external deps ( aside of TS )
- There is 3 packages,
consumer
which depends onmiddle
which depends ontypes
Add types in packages/consumer
:
pnpm --filter consumer add -D types
Then, in packages/consumer/index.ts
import types
import type {} from "types";
This will make typescript aware of how to forward the types