-
Notifications
You must be signed in to change notification settings - Fork 769
Open
Description
Summary
tsgo hangs indefinitely on code that tsc handles fine.
Reproduction
https://github.com/jasonkuhrt/repro-tsgo-hang
pnpm install
pnpm demo:works # tsc completes
pnpm demo:hangs # tsgo hangsWorkarounds
- Exporting the internal
Thing_type fixes hang - Removing
declaration:truefrom tsconfig fixes hang - Removing namespace wrapper fixes hang
Minimal Code
tsconfig.json
{
"compilerOptions": {
"noEmit": true,
"declaration": true
},
"include": ["repro.ts"]
}repro.ts
type U<$A, $B, $C> =
$B extends 0 ? any :
$A extends any ? Omit<$A, 0> & $C :
any
export class A {
static fromString = <$input>(
input: A.Thing<$input, A.NameEmpty>
) => null as any
}
export namespace A {
export type Name = { b: any[]; a: any }
export type NameEmpty = { b: []; a: null }
type Add<$A extends Name, $B> =
$A['a'] extends any
? U<$A, '', $B>
: U<$A, '', $B>
export type Thing<$A, $B extends Name> = Thing_<$A, $B>
type Thing_<$A, $B extends Name> =
$A extends `` ? $B :
$A extends `${infer v} ${infer tail}` ? Thing_<tail, Add<$B, v>> :
$A extends `${infer v}` ? Add<$B, v> :
'unknown'
}Environment
- tsgo: 7.0.0-dev.20251216.1 (@typescript/native-preview)
- tsc: 5.7.2
PaulRBerg, FloChehab, smaccoun, gkiely, shrujalshah28 and 1 more
Metadata
Metadata
Assignees
Labels
No labels