🔎 Search Terms
RangeError: Maximum call stack size exceeded, #52392
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?#code/KYDwDg9gTgLgBAbwL4G4BQaAmwDGAbAQymDgICMBnGKAnefAiiuAFQE8xgARAmAgWQjY8AHgAKRYADsYAPkRo4cMJJkAuOBOIz0i5cRXEuwKAEsAbsEw8+ACj1KYAC1MUNz13FAxpmZgmVVGA1TKQAzEzgAfTgkOAB+OClgSyg4DWTUvQBKDXMIU0x0JAxsBmI4BiY4ACFGYABJHwBbLxAfKT84LggcAFdm6RgRAik2eQQ9QyGNOopGloA6LSHirFxCCqkCQYoVHBI5heBWyccOEhWZOABeOBgLiDC4AEE6aDEWACUAJmA19blEgAczwEDIBDwCiU212+xIYQgfU6UDY0KUbUgsDgpmaWPgUQAqlI+vNMLdavUmid0EoSiVAZsSFVmNTWt5fMwev1BtdkKUNpJKoRqgAxCB4bBQT6-EhnOAgdyPZ5vGAfb5-AFlJnCxjMVXq2XothKzhPODiyUmGWavQALw07E4NgEQmAogeZuebNkAM9JGMwDAWhgpkhIhYbQ6XXBACtcHIKfKANoAaRxUjgAGtgGxzSwALrxDRRQPBoih8MsNMF31oVBof3RMshsOiFjyO6RjmdZhxhMJbrAIOtqvyR26bVClndXoDIYAZScw5gADUfiJufOZAAaOAAYQg4VMwL6NFDR6jnLg-boFNG43ROCPVCgfXeUHsGJvYAvUjcQ4jhWbYiIex6nuephHvIABk6Lfpgc68sEs48qsDixDkWqChUz7-vAiJWlAprAOalpSja-xoMkADuqHbjAS4ruutgBIhaHqHAhFSrE2ToEAA
💻 Code
export{};declareabstractclassTypeDataModel<Parent>{parent: Parent;prepareDerivedData(this: this extends{parent: infer _} ? never : never): void;}declareclassBaseItemextendsDocument<any>{parent: BaseItem.Parent;}declarenamespaceBaseItem{typeParent=typeofActorPTR2e;}declare global {namespacefoundry{exportimport_Unused=BaseItem;}}declareclassItemextendsDocument{}declareclassFolderPTR2e{x: typeofActorPTR2e;}declareclassActorPTR2e{y: typeofFolderPTR2e;z: TypeDataModel<typeofItem>;}typeDeepPartial<Textendsobject>={[KinkeyofT]?: _DeepPartial<T[K]>;};type_DeepPartial<T>=Textendsobject ? DeepPartial<T> : T;declareclassDocumentSheetV2<Document,Configurationextendsobject=any>{constructor(options: DeepPartial<Configuration>&{document: Document;});}declareconstfolder: typeofFolderPTR2e;newDocumentSheetV2({document: folder});🙁 Actual behavior
The compiler crashes with RangeError: Maximum call stack size exceeded.
RangeError: Maximum call stack size exceeded
at structuredTypeRelatedToWorker (node_modules/typescript/lib/_tsc.js:64885:43)
at structuredTypeRelatedTo (node_modules/typescript/lib/_tsc.js:64817:21)
at recursiveTypeRelatedTo (node_modules/typescript/lib/_tsc.js:64768:19)
at isRelatedTo (node_modules/typescript/lib/_tsc.js:64186:122)
at isPropertySymbolTypeRelated (node_modules/typescript/lib/_tsc.js:65563:14)
at propertyRelatedTo (node_modules/typescript/lib/_tsc.js:65603:23)
at propertiesRelatedTo (node_modules/typescript/lib/_tsc.js:65814:29)
at structuredTypeRelatedToWorker (node_modules/typescript/lib/_tsc.js:65361:21)
at structuredTypeRelatedTo (node_modules/typescript/lib/_tsc.js:64817:21)
at recursiveTypeRelatedTo (node_modules/typescript/lib/_tsc.js:64768:19)
(this is on 5.8.0-dev.20250106 but the same error appears on 5.7.2 and several other versions I tested as well as all the ones I bisected)
🙂 Expected behavior
Regular errors. This file has a few but in my original repo there were less, possibly none?
The editor doesn't crash and reports these errors:
Type instantiation is excessively deep and possibly infinite.
Expression produces a union type that is too complex to represent.
On DocumentSheetV2. I find the second one odd because there's not a single union in the program.
There's also the error:
No base constructor has the specified number of type arguments.
On Document<any>, because Document doesn't take type arguments. In my original repo I wasn't passing a generic to a class without one but this was the easiest way to reliably reproduce it. I can get it to work without the <any> but it was simply less reliable while I was reducing so I left it in.
Additional information about the issue
No response
🔎 Search Terms
RangeError: Maximum call stack size exceeded, #52392
🕗 Version & Regression Information
intersectionStatein relations #52392⏯ Playground Link
https://www.typescriptlang.org/play/?#code/KYDwDg9gTgLgBAbwL4G4BQaAmwDGAbAQymDgICMBnGKAnefAiiuAFQE8xgARAmAgWQjY8AHgAKRYADsYAPkRo4cMJJkAuOBOIz0i5cRXEuwKAEsAbsEw8+ACj1KYAC1MUNz13FAxpmZgmVVGA1TKQAzEzgAfTgkOAB+OClgSyg4DWTUvQBKDXMIU0x0JAxsBmI4BiY4ACFGYABJHwBbLxAfKT84LggcAFdm6RgRAik2eQQ9QyGNOopGloA6LSHirFxCCqkCQYoVHBI5heBWyccOEhWZOABeOBgLiDC4AEE6aDEWACUAJmA19blEgAczwEDIBDwCiU212+xIYQgfU6UDY0KUbUgsDgpmaWPgUQAqlI+vNMLdavUmid0EoSiVAZsSFVmNTWt5fMwev1BtdkKUNpJKoRqgAxCB4bBQT6-EhnOAgdyPZ5vGAfb5-AFlJnCxjMVXq2XothKzhPODiyUmGWavQALw07E4NgEQmAogeZuebNkAM9JGMwDAWhgpkhIhYbQ6XXBACtcHIKfKANoAaRxUjgAGtgGxzSwALrxDRRQPBoih8MsNMF31oVBof3RMshsOiFjyO6RjmdZhxhMJbrAIOtqvyR26bVClndXoDIYAZScw5gADUfiJufOZAAaOAAYQg4VMwL6NFDR6jnLg-boFNG43ROCPVCgfXeUHsGJvYAvUjcQ4jhWbYiIex6nuephHvIABk6Lfpgc68sEs48qsDixDkWqChUz7-vAiJWlAprAOalpSja-xoMkADuqHbjAS4ruutgBIhaHqHAhFSrE2ToEAA
💻 Code
🙁 Actual behavior
The compiler crashes with
RangeError: Maximum call stack size exceeded.(this is on 5.8.0-dev.20250106 but the same error appears on 5.7.2 and several other versions I tested as well as all the ones I bisected)
🙂 Expected behavior
Regular errors. This file has a few but in my original repo there were less, possibly none?
The editor doesn't crash and reports these errors:
On
DocumentSheetV2. I find the second one odd because there's not a single union in the program.There's also the error:
On
Document<any>, becauseDocumentdoesn't take type arguments. In my original repo I wasn't passing a generic to a class without one but this was the easiest way to reliably reproduce it. I can get it to work without the<any>but it was simply less reliable while I was reducing so I left it in.Additional information about the issue
No response