Description
A project at my job causes a stack overflow with tsgo, but compiles with tsc.
Tracked it down to a recursive object transformation function that changes the casing of the object's string properties.
It uses the CamelCase type from type-fest.
I have a code example that's as minimal as I could figure out how to make it: https://github.com/wadjoh/tsgo-crash-repro.
EDIT: The crashing seems to have started happening with type-fest version 4.38.0 and starts working again with version 5.0.0.
Change in 4.38.0 that started causing the crashing: sindresorhus/type-fest#1081
Diff of 4.41.0 and 5.0.0 (not sure which of the changes stops the crashing): sindresorhus/type-fest@v4.41.0...v5.0.0
Stack trace
The full stack trace is large so I'll paste the first part of it here and paste a link to a gist with the full stack trace.
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x44423d7f0570 stack=[0x44423d7f0000, 0x44425d7f0000]
fatal error: stack overflow
runtime stack:
runtime.throw({0x104c6d915?, 0x1045baed4?})
runtime/panic.go:1229 +0x38 fp=0x16b8768e0 sp=0x16b8768b0 pc=0x1046015d8
runtime.newstack()
runtime/stack.go:1178 +0x498 fp=0x16b876a10 sp=0x16b8768e0 pc=0x1045e8648
runtime.morestack()
runtime/asm_arm64.s:507 +0x70 fp=0x16b876a10 sp=0x16b876a10 pc=0x104607070
Full stack trace: https://gist.github.com/wadjoh/82adc287ab15357812c8e2da247163c3
Steps to reproduce
- Clone https://github.com/wadjoh/tsgo-crash-repro
- Run
pnpm i
- Run
pnpm check:tsgo
- Observe stack overflow panic
You can also run pnpm check:tsc and see that it successfully compiles.
Example code that causes the crash
import { CamelCase } from "type-fest";
const transform = <TResult>(iteratee: any): TResult => undefined as any;
const camelize = <T extends object>(): CamelCase<T> => transform(camelize);
Description
A project at my job causes a stack overflow with
tsgo, but compiles withtsc.Tracked it down to a recursive object transformation function that changes the casing of the object's string properties.
It uses the
CamelCasetype from type-fest.I have a code example that's as minimal as I could figure out how to make it: https://github.com/wadjoh/tsgo-crash-repro.
EDIT: The crashing seems to have started happening with
type-festversion4.38.0and starts working again with version5.0.0.Change in
4.38.0that started causing the crashing: sindresorhus/type-fest#1081Diff of
4.41.0and5.0.0(not sure which of the changes stops the crashing): sindresorhus/type-fest@v4.41.0...v5.0.0Stack trace
The full stack trace is large so I'll paste the first part of it here and paste a link to a gist with the full stack trace.
Full stack trace: https://gist.github.com/wadjoh/82adc287ab15357812c8e2da247163c3
Steps to reproduce
pnpm ipnpm check:tsgoYou can also run
pnpm check:tscand see that it successfully compiles.Example code that causes the crash