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
v5.5.4 regression "Error: Debug Failure. False expression." when using incremental const x = { ...({} as { [K in keyof { someKey?: any }]?: undefined }) }#60511
Open
700software opened this issue
Nov 15, 2024
· 1 comment
Ran into this hard to find bug crashing our production build. It was difficult to get a Minimal Reproducible Example for you but after hours of work I finally narrowed it down. Check it out!
Using combination of
{ "compilerOptions": { "incremental": true } }
npm install -D @types/node done after tsconfig.tsbuildinfo already exists
Note: This particular sequence is not required for production repro but is the only way I could get this Minimal Reproducible Example for sake of opening this issue. In production, of course, tsconfig.tsbuildinfo is absent on every build to keep things fresh. :)
runtime object expansion
wrapper type to
make properties optional
make properties undefined
avoid using as const
Am getting crash of typescript build.
Changing any one of these 6 things causes the crash to go away.
🕗 Version & Regression Information
Works fine in 5.5.3
Broken in 5.5.4 & 5.6.3 & 5.7.0-beta
⏯ Playground Link
No repro because incremental checkbox not in playground.
💻 Code
test.ts
typeInputType={enable_member_receipts?: boolean};typeAsEmptyObject<T>={[KinkeyofT]?: undefined};// This is a utility type we use internally.consttest={// ...
...({}asAsEmptyObject<InputType>),};// omit `as const`
tsconfig.json
{
"compilerOptions": {
"incremental": true,
}
}
🙁 Actual behavior
PS C:\GitHub\tmp\repro-ts-bug> tsc --noEmit
C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:120986
throw e;
^
Error: Debug Failure. False expression.
at getOptionalType (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:66203:11)
at tryReuseExistingTypeNode (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:49675:16)
at serializeTypeForDeclaration (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:51693:61)
at addPropertyToElementList (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:50663:43)
at createTypeNodesFromResolvedType (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:50559:11)
at createTypeNodeFromObjectType (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:50334:25)
at visitAndTransformType (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:50257:24)
at createAnonymousTypeNode (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:50197:20)
at typeToTypeNodeWorker (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:49990:16)
at typeToTypeNodeHelper (C:\GitHub\tmp\repro-ts-bug\node_modules\typescript\lib\tsc.js:49771:24)
Node.js v22.8.0
PS C:\GitHub\tmp\repro-ts-bug>
The text was updated successfully, but these errors were encountered:
700software
changed the title
v5.6.3 regression "Error: Debug Failure. False expression." when using incremental + @types/node + const x = { ...({} as { [K in keyof { someKey?: any }]?: undefined }) }
v5.6.3 regression "Error: Debug Failure. False expression." when using incremental const x = { ...({} as { [K in keyof { someKey?: any }]?: undefined }) }Nov 15, 2024
700software
changed the title
v5.6.3 regression "Error: Debug Failure. False expression." when using incremental const x = { ...({} as { [K in keyof { someKey?: any }]?: undefined }) }
v5.5.4 regression "Error: Debug Failure. False expression." when using incremental const x = { ...({} as { [K in keyof { someKey?: any }]?: undefined }) }Nov 15, 2024
🔎 Search TermsDescriptionRan into this hard to find bug crashing our production build. It was difficult to get a Minimal Reproducible Example for you but after hours of work I finally narrowed it down. Check it out!
Using combination of
{ "compilerOptions": { "incremental": true } }
npm install -D @types/node
done aftertsconfig.tsbuildinfo
already existstsconfig.tsbuildinfo
is absent on every build to keep things fresh. :)as const
Am getting crash of typescript build.
Changing any one of these 6 things causes the crash to go away.
🕗 Version & Regression Information
Works fine in 5.5.3
Broken in 5.5.4 & 5.6.3 & 5.7.0-beta
⏯ Playground Link
No repro because incremental checkbox not in playground.
💻 Code
test.ts
tsconfig.json
🙁 Actual behavior
🙂 Expected behavior
Additional information about the issue
I needed this specific sequence to repro:
Replace
[email protected]
with the version you desire to test.The text was updated successfully, but these errors were encountered: