-
Notifications
You must be signed in to change notification settings - Fork 701
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
Maximum call stack size exceeded for complex type #2507
Comments
Thanks for the minimal reproduction! Getting it down this far will help a ton when figuring out what went wrong here. I suspect the recursive |
export interface Value {
values: Value[];
}
export function fromPartial<I extends Exact<Value, I>>(object: I): void {
throw 1;
}
type Exact<P, I extends P> = P extends P ? P & { [K in keyof P]: Exact<P[K], I[K]> } : never; Further reduced, different infinite recursion in currently released version, but I suspect the same underlying cause. |
After a couple hours spent digging into this... It's not a super easy fix unfortunately. If you hover over the signature, you can see the type that TypeDoc is trying to convert. Notice all the type InternalOnly = true;
export type IfInternal<T, F> = InternalOnly extends true ? T : F;
function over(flag: 'a' | 'b'): string
function over(flag: IfInternal<never, string>): string
function over(flag: string): string { return flag } Where It is also nice for dealing with fully resolved type parameters, particularly with inheritance from generic classes. // docs for MyList.at should show that it returns `string`, not `T`
class MyList extends Array<string> {} There have been lots of issues requesting both that TypeDoc do more of this type resolution and that it do less of it... making it configurable is the obvious "solution"... if there was an easy way to do so, which there really isn't, at least that I've been able to come up with. |
Search terms
Hi! I have a complex type generated with
ts-proto
, which is causing typedoc to crash with infinite recursion somewhere inside tsc.Expected Behavior
Not crash.
Actual Behavior
Steps to reproduce the bug
I tried to make this as minimal as possible. There's probably still something I managed to miss, but at least it's better than the original 540-line file.
Also available at TypeStrong/typedoc-repros#39
Environment
The text was updated successfully, but these errors were encountered: