mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-10-28 16:36:04 +08:00
Recursive values can have valid declaration types without annotations. Separate function and alias fallbacks leave equivalent constructs with different results, and broader value annotations can silently weaken the recursive type. Keep ordinary type names independent of the definitions being emitted. Share definition context across syntax reuse and structural expansion so recursive references and cycle detection agree on what is in scope. A value self-reference must cross a lazy resolution boundary, and names usable in local displays are not necessarily usable in declarations. Starting from a selected signature must not add an extra recursive unfolding merely because its containing type was not traversed. Preserve isolated declaration inference restrictions and prevent cached output from crossing incompatible recursion contexts. Captured generic substitutions must not escape into parameters bound by a re-entered signature. Otherwise declaration consumers lose valid calls even when the original source infers the correct result. Fixes 55832