Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 726 Bytes

README.md

File metadata and controls

38 lines (24 loc) · 726 Bytes

ts-indirect-type-reference-bug

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

Architecture

  • No external deps ( aside of TS )
  • There is 3 packages, consumer which depends on middle which depends on types

Solution

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