-
Notifications
You must be signed in to change notification settings - Fork 662
Open
Labels
CrashDomain: Declaration EmitRelated to declaration emit, type printingRelated to declaration emit, type printing
Description
tsgo panics when processing Knex module augmentations with complex generic constraints.
Reproduction
Minimal reproduction: https://github.com/vpontis/tsgo-panic
git clone https://github.com/vpontis/tsgo-panic
cd tsgo-panic
bun install
bun tsgo # panics
bun tsc # works fine
Stack Trace
panic: runtime error: slice bounds out of range [:52400] with length 524
goroutine 1 [running]:
github.com/microsoft/typescript-go/scanner.(*Scanner).GetLineAndCharacterOfPosition(...)
/Users/victor/go/pkg/mod/github.com/microsoft/typescript-go@v0.0.0-20250116223143-00ad56e4d9d7/scanner/scanner.go:3156
github.com/microsoft/typescript-go/scanner.GetLineAndCharacterOfPosition(...)
/Users/victor/go/pkg/mod/github.com/microsoft/typescript-go@v0.0.0-20250116223143-00ad56e4d9d7/scanner/utilities.go:1222
github.com/microsoft/typescript-go/transformer.(*transformer).getJSONTypeArgument(0xc002c12240, 0xc0053084c0)
/Users/victor/go/pkg/mod/github.com/microsoft/typescript-go@v0.0.0-20250116223143-00ad56e4d9d7/transformer/declarations.go:2172 +0x125
File
import "knex";
// Minimal reproduction of the module augmentation that causes tsgo panic
declare module "knex" {
namespace Knex {
interface QueryInterface<TRecord extends {} = any> {
firstOrFail<TKey extends keyof TRecord>(
...columns: TKey[]
): Knex.QueryBuilder<TRecord, Pick<TRecord, TKey>> &
Promise<Pick<TRecord, TKey>>;
}
}
}
Metadata
Metadata
Assignees
Labels
CrashDomain: Declaration EmitRelated to declaration emit, type printingRelated to declaration emit, type printing