microsoft / microsoft/TypeScript
`symbolToNode` stack overflow when using recursive types and functions with type parameters
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
🔎 Search Terms
"symbolToNode", "stack overflow", "Maximum call stack size exceeded"
🕗 Version & Regression Information
This is happening in v5, v6, and tsgo (I didn't check prior versions)
⏯ Playground Link
No response
💻 Code
Coming from https://github.com/typescript-eslint/typescript-eslint/issues/11947, I created a reproduction that's agnostic to ESLint:
export interface CustomNode<P> {
getNextNode: () => CustomNode<P>;
}
export declare const createNode: () => {
getNextNode: <T>() => CustomNode<T>;
};
function wrapNode<T>(getNode: () => CustomNode<T>) {
// ...
// Wrapping logic here
// ...
return getNode;
}
wrapNode(() => {
const node = createNode();
return wrapNode<typeof node.getNextNode<any>>(node.getNextNode);
});
Full Repro and more details: https://github.com/StyleShit/repros/tree/main/ts-symbolToNode-stack-overflow
🙁 Actual behavior
Running tsc is failing with "Maximum call stack size exceeded" error
🙂 Expected behavior
Running tsc should not fail
Additional information about the issue
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia eseguendo tsc sulla riproduzione collegata e tracciando il percorso symbolToNode coinvolto nei tipi e nelle funzioni generici ricorsivi. Individua il punto in cui la conversione ricorsiva raggiunge il limite dello stack delle chiamate, quindi verifica che la riproduzione venga compilata senza l’errore Maximum call stack size exceeded nelle versioni del compilatore interessate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100