You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Aliased Partial<{ … }> is duplicated when instantiated again: quadratic inference, spurious TS2859, repeated union members #65560
The tested TypeScript version is 7.1.0-dev (main at e086ad3). 7.0.2, 6.0.3, 5.9.3, 5.4.5, 4.9.5 and 4.2.4 behave the same.
OS: macOS 26.5 (arm64). Timings below are from main, with --singleThreaded.
User Goal
The user's project type-checked slowly and they asked me to find out why. It came down to one type alias, in a way that looks like a TypeScript bug, and they asked me to report it.
What I expected: the result of the right-hand column. Both declarations of Options describe the same type, and so does Partial<Named> with type Named = { verbose: boolean }, which is also fast.
The cause shows without any timing. After a map that returns its argument, Options is a second type:
I expected string | Partial<{ verbose: boolean; }>.
Other ways to get the same result:
Readonly<{ … }>, or any alias of { [K in keyof T]: … } applied to a type literal.
No alias, with a union of type literals as the argument: Partial<{ a: boolean } | { b: string }>.
Two aliases of one instantiation: with type A1 = Partial<Named> and type A2 = Partial<Named>, the type A1 | A2 prints as Partial<Named> | Partial<Named>.
A CPU profile of slow.ts has 82 % of the samples under inferFromMatchingTypes → isTypeIdenticalTo.
In the project where this was found (about 4,000 files, 4 checkers), avoiding the duplicate takes the check time from 15–18 s to 4.7–4.9 s.
Agent Info
Claude Code 2.1.327 + Claude Fable 5.2 + Skill Version 1.0
Activity