Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

TypeScript 7.1 reports an infinitely circular instantiation on bounded types

TypeScript 7.1 reports an error on code that TypeScript 7.0 accepts:

repro.ts(76,12): error TS5115: Instantiations of the following types appear infinitely circular: 'InferData', 'UnpackKeyValue'.

We hit it on a real AdonisJS application with the types of @adonisjs/http-transformers 2.3.1. repro.ts has no dependencies: it keeps only the parts of that package's types the error needs. Their recursion is bounded: Depth steps through Next = [1, 2, 3, 4, 5, 6], so the instantiation cannot be infinite.

Run it

npm install
npm run check:all
Checker Result
typescript 7.0.2 no error
typescript 7.1.0-dev.20260805.1 no error
typescript 7.1.0-dev.20260806.1 TS2589: Type instantiation is excessively deep and possibly infinite.
typescript 7.1.0-dev.20261111.1 (next) TS5115

Where it comes from

The two nightlies differ by a single commit, microsoft/typescript-go#4820 "Order variance computation by associated type symbol". That commit makes the error appear as TS2589. microsoft/TypeScript#64372 "Restore idempotency to resolveObjectTypeMembers" later turned it into TS5115 (first in 7.1.0-dev.20260929.1).

tsrs, which ports TypeScript 7.1, reports the same TS5115.

What triggers it

The error appears only when the Item comes back from a closure passed to a generic function:

declare function once<T>(value: T): T;
once(() => SizeTransformer.transform(new Size())); // TS5115
once(SizeTransformer.transform(new Size()));       // no error

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages