-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Milestone
Description
Bug Report
π Search Terms
Maximum call stack size exceeded
getMappedType
π Version & Regression Information
- This is a crash
- This changed between versions 4.6.4 and 4.7.4
β― Playground Link
Playground link with relevant code
π» Code
class Foo<Elements extends readonly unknown[]> {
public readonly elements: { [P in keyof Elements]: { bar: Elements[P]; } };
public constructor(...elements: { [P in keyof Elements]: { bar: Elements[P] } }) {
this.elements = elements;
}
public add(): Foo<[...Elements, 'abc']> {
return new Foo<[...Elements, 'abc']>(...this.elements, { bar: 'abc' });
}
}
π Actual behavior
The compiler crashes with a stack overflow error
π Expected behavior
Compilation should succeed with no errors. Extracting the inline mapped type to its own type definition achieves this, but the two are logically identical so the stack overflow is unexpected.