Skip to content

RangeError: Maximum call stack size exceeded in getTypeFromTypeNode when resolving recursive tuple rest with intersectionΒ #63040

@na7ure-a

Description

@na7ure-a

πŸ”Ž Search Terms

RangeError: Maximum call stack size exceeded

getTypeFromTypeNode

getImpliedConstraint

Recursive tuple rest

Intersection type crash

πŸ•— Version & Regression Information

Crashes in 5.7.3, 5.8.3, 5.9.3, and Nightly.

⏯ Playground Link

https://www.typescriptlang.org/zh/play/?target=7&ts=6.0.0-dev.20260122#code/C4TwDgpgBAysBOBLAdgcwCrwhAgveAhiDgM7oCuYANhADzoB8UAvFABTpQQAewEyAExJQA2gDoJKAGYR4UAEoBdKAH5REsXCRpM2PIWJlKNWvIbKoASigAyKACMA9o5oFkQA

πŸ’» Code

type StringTreeArrayAsTuple<T> = (T extends [...infer R] ? [...StringTreeArrayAsTuple<R>]  ) & boolean

πŸ™ Actual behavior

 .\ts-versions\nightly\node_modules\.bin\tsc.cmd     interfaceDoesNotDependOnBaseTypes_enriched_deep_mutated_batch6.ts         
D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:123178
      throw e;
      ^

RangeError: Maximum call stack size exceeded
    at getTypeFromTypeReference (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:60415:36)                                                                                        
    at getTypeFromTypeNodeWorker (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63093:16)                                                                                       
    at getTypeFromTypeNode (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63055:41)                                                                                             
    at getImpliedConstraint (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:60310:182)                                                                                           
    at getConditionalFlowTypeOfType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:60321:28)                                                                                    
    at getTypeFromTypeNode (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63055:12)                                                                                             
    at getTypeFromRestTypeNode (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63026:12)                                                                                         
    at getTypeFromTypeNodeWorker (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63120:16)                                                                                       
    at getTypeFromTypeNode (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63055:41)                                                                                             
    at map (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:196:19)                                                                                                               

πŸ™‚ Expected behavior

The compiler should not crash.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions