type-fest
type-fest copied to clipboard
Weird bug report - RangeError: Maximum call stack size exceeded when building
I forked this repo "https://github.com/bottenderjs/messaging-apis" because I need to change some of functionality and overall update of packages. Fork is here: https://github.com/sunray-eu/messaging-apis-custom/blob/9cc3f6a846203ffe6833e7aac0f987e3f84a913d/packages/messaging-api-common/src/case.ts#L210 -> In this package and file, there is issue when I upgrade to latest version that I cannot solve. When I upgrade 'type-fest' until 4.7.1, it works even without changing anything. When I upgrade to 4.8.0+, then it breaks and while build it shows this: RangeError: Maximum call stack size exceeded when building.
I managed to isolate issue to messaging-api-common package and to method in link above. I found these conditions when it work or not work:
- It works normally until '4.7.1' (Tested literally all versions between '1.4.0' and '4.7.1')
- When it is on '4.8.0+' then it breaks, I isolated issue in method
pascalcaseKeysin the link above. When I remove this conditional typing and set it constantly either toPascalCasedPropertiesDeeporPascalCasedProperties, it works:
O['deep'] extends true
? PascalCasedPropertiesDeep<T>
: PascalCasedProperties<T>
How to reproduce?
just clone repo, set version of type-fest to 4.8.0 in messaging-api-common workspace and simply run yarn - it will run also yarn compile
My question is, if this is issue in type-fest or in implementation that code use. Also, how could I solve this with conditional checking kept?
Thanks in advance!
Try newly released v4.10.2 and see if that helps. It dealt with such a problem in TypeScript 5.4