From d369700617902fc8de01243dcccf77d007dcffb8 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 11 Jan 2024 14:27:02 -0800 Subject: [PATCH] Accept new baselines --- ...neMappedGenericTupleTypeNoCrash.errors.txt | 20 +++++++++++++++++++ ...rInlineMappedGenericTupleTypeNoCrash.types | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/circularInlineMappedGenericTupleTypeNoCrash.errors.txt diff --git a/tests/baselines/reference/circularInlineMappedGenericTupleTypeNoCrash.errors.txt b/tests/baselines/reference/circularInlineMappedGenericTupleTypeNoCrash.errors.txt new file mode 100644 index 0000000000000..8d568d19a5373 --- /dev/null +++ b/tests/baselines/reference/circularInlineMappedGenericTupleTypeNoCrash.errors.txt @@ -0,0 +1,20 @@ +circularInlineMappedGenericTupleTypeNoCrash.ts(11,12): error TS2589: Type instantiation is excessively deep and possibly infinite. + + +==== circularInlineMappedGenericTupleTypeNoCrash.ts (1 errors) ==== + class Foo { + 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" }); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2589: Type instantiation is excessively deep and possibly infinite. + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/circularInlineMappedGenericTupleTypeNoCrash.types b/tests/baselines/reference/circularInlineMappedGenericTupleTypeNoCrash.types index 638640eeda181..660b3ff1bac7e 100644 --- a/tests/baselines/reference/circularInlineMappedGenericTupleTypeNoCrash.types +++ b/tests/baselines/reference/circularInlineMappedGenericTupleTypeNoCrash.types @@ -32,8 +32,8 @@ class Foo { >this.elements : { [P in keyof Elements]: { bar: Elements[P]; }; } >this : this >elements : { [P in keyof Elements]: { bar: Elements[P]; }; } ->{ bar: "abc" } : { bar: "abc"; } ->bar : "abc" +>{ bar: "abc" } : { bar: string; } +>bar : string >"abc" : "abc" } }