-
Notifications
You must be signed in to change notification settings - Fork 12.8k
JSDocs @typedef parsing runs into infinite loop #40234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I see what's going on. The JSDocs parser is including I can work around the issue by breaking apart the first part into its own type first. export type XMLObjectBase<T> = {
$A: {
[P in keyof T]?: XMLObject<T[P]>[]
},
$O: {
[P in keyof T]?: {
$$?: Record<string, string>
} & (T[P] extends string ? {$:string} : XMLObject<T[P]>)
},
$$?: Record<string, string>,
};
export type XMLObject<T> = XMLObjectBase<T> & {
[K in keyof T]?: (T[K] extends string ? string : XMLObject<T[K]>)
}; The parser is probably compiling a type as one big one on the fly and getting stuck in an infinite loop. |
I thought this might be the result of changing |
The code that makes recursive type aliases work failed on typedefs. #40861 fixes this. |
TypeScript Version: v4.1.0-dev.20200824
Search Terms:
Code
TS:
JS:
Expected behavior:
VSCode Intellisense outputs should match and results should somewhat as fast in JS as in TS.
Actual behavior:
Extremely long parsing time, Intellisense mismatch and long, infinitely looping type details. Hovering over
XMLObject
in the playground link takes a very long time on JS.JS:
TS:

Playground Link:
JS: https://www.typescriptlang.org/play?ts=4.1.0-dev.20200824&useJavaScript=true#code/PQKhCgAIUgBAXApgWwA4BsCGTIBUowICeqiAJogGaQDeNUkAJAIIBctDkkA2gNKQBLAHaQA1oiIB7argC6AfnYANALIAZAPIAjAFaIAxvAA8uPrIB83WQwC+AGgaMN7ely59BI8VJkKXnN0ZGRUgAJQNJACcyIwBneEjhAHM7SHjEoSTzAJtIADJIAApTXllIRAAPJCEyWLSE5Mh5WkZWdOTc5XVtPUMTM3MASlsHLiCQ8P0omPbM1Nms0chcgtcefmExCWk8PyKAkrLK6tr6jKSms+SAri7NXQNjQ+yuYZtc1Xvep-NoYHBwKBCPASIhaJ8eo8jDRKJJJG0GpkbOZciB-lMhPFIKhIABeWg2ADc4CAA
TS: https://www.typescriptlang.org/play?ts=4.1.0-dev.20200824#code/KYDwDg9gTgLgBDAnmYcAaBZAMgeQEYBWwAxjADwAqAfHALxwDeAUHHACQCCAXIy63AG0A0nACWAOzgBrYIggAzOBQC6Afh6ZchEuQrDlVAcr4BfADR82OHs36CRE6bIVK1NvnbZt1cAEoloABMyAGcYKAkAczM4MIjxSKoPOBM4ADI4AAo9IWU4UBhgcUCQ2PCouFVGNi44qNSNbHwiUkp9KgBKUwtWLx9-YiDQ8oSYuoSqHpT03lZhMUkZOUUVH0zknLyCopKy+MjKvajk1katFt12vi6TAG4mJkHxMLgwLk1mnTIGeQgIWpGkRMNHoDDuTCAA
Related Issues:
The text was updated successfully, but these errors were encountered: