[microsoft/TypeScript] Crash: RangeError: Maximum call stack size exceeded in addTypesToUnion when using incomplete keyof type annotation on object destructuring (Issue #62993)
DRANK

na7ure-a created an issue (microsoft/TypeScript#62993) ### 🔎 Search Terms addTypesToUnion stack overflow getUnionTypeWorker crash keyof missing type crash Internal Compiler Error destructuring ### 🕗 Version & Regression Information v5.7.3 / v5.8.3 / v5.9.3 / Nightly: Crashes(This crash only occurs when the --strict flag is enabled.) ### ⏯ Playground Link https://www.typescriptlang.org/zh/play/?target=7&ts=6.0.0-dev.20260115#code/MYewdgzgLgBA3jYAaGATFBTFAzFBzGAXwC4YBrDATxGxhgF54AoOugOg7hdZ47a56DWfAULF1gpAAxJu4uoVnzWqaXMGL1PDGp6ae2JoQDcQA ### 💻 Code ```ts const { c, d, e, f, g }: keyof = { ...{ ...{ ...{ c: 0, }, d: 0 }, e: 0 }, f }; ``` ### 🙁 Actual behavior ``` .\ts-versions\nightly\node_modules\.bin\tsc.cmd --strict .\mutated\destructuringSpread_mutated_batch15.ts D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:123166 throw e; ^ RangeError: Maximum call stack size exceeded at addTypesToUnion (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:61209:27) at getUnionTypeWorker (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:61385:22) at getUnionType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:61381:12) at mapType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:69885:37) at getApparentTypeOfContextualType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:73263:28) at checkObjectLiteral (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:73978:28) at checkExpressionWorker (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:80883:16) at checkExpression (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:80794:32) at checkObjectLiteral (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:74062:37) at checkExpressionWorker (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:80883:16) Node.js v22.19.0 ``` ### 🙂 Expected behavior The compiler should report a syntax error and not crash. ### Additional information about the issue _No response_ -- Reply to this email directly or view it on GitHub: https://github.com/microsoft/TypeScript/issues/62993 You are receiving this because you are subscribed to this thread. Message ID: <microsoft/TypeScript/issues/62993@github.com>

github.com
Related Topics: TypeScript
1 comments