Skip to content

Commit e7018d2

Browse files
committed
Add regression test
1 parent 670946d commit e7018d2

5 files changed

+189
-0
lines changed

tests/baselines/reference/nestedExcessPropertyChecking.errors.txt

+25
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,29 @@ nestedExcessPropertyChecking.ts(40,9): error TS2559: Type 'false' has no propert
8888
},
8989
},
9090
};
91+
92+
// Repro from #53412
93+
94+
type BaseItem = {
95+
id: number;
96+
}
97+
type ExtendedItem = BaseItem & {
98+
description: string | null
99+
};
100+
101+
type BaseValue = {
102+
// there are other fields
103+
items: BaseItem[];
104+
}
105+
type ExtendedValue = BaseValue & {
106+
// there are other fields
107+
items: ExtendedItem[];
108+
}
109+
110+
const TEST_VALUE: ExtendedValue = {
111+
items: [
112+
{id: 1, description: null},
113+
{id: 2, description: 'wigglytubble'},
114+
]
115+
};
91116

tests/baselines/reference/nestedExcessPropertyChecking.js

+31
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,31 @@ const response: Query = {
6464
},
6565
},
6666
};
67+
68+
// Repro from #53412
69+
70+
type BaseItem = {
71+
id: number;
72+
}
73+
type ExtendedItem = BaseItem & {
74+
description: string | null
75+
};
76+
77+
type BaseValue = {
78+
// there are other fields
79+
items: BaseItem[];
80+
}
81+
type ExtendedValue = BaseValue & {
82+
// there are other fields
83+
items: ExtendedItem[];
84+
}
85+
86+
const TEST_VALUE: ExtendedValue = {
87+
items: [
88+
{id: 1, description: null},
89+
{id: 2, description: 'wigglytubble'},
90+
]
91+
};
6792

6893

6994
//// [nestedExcessPropertyChecking.js]
@@ -90,3 +115,9 @@ var response = {
90115
},
91116
},
92117
};
118+
var TEST_VALUE = {
119+
items: [
120+
{ id: 1, description: null },
121+
{ id: 2, description: 'wigglytubble' },
122+
]
123+
};

tests/baselines/reference/nestedExcessPropertyChecking.symbols

+53
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,56 @@ const response: Query = {
165165
},
166166
};
167167

168+
// Repro from #53412
169+
170+
type BaseItem = {
171+
>BaseItem : Symbol(BaseItem, Decl(nestedExcessPropertyChecking.ts, 62, 2))
172+
173+
id: number;
174+
>id : Symbol(id, Decl(nestedExcessPropertyChecking.ts, 66, 17))
175+
}
176+
type ExtendedItem = BaseItem & {
177+
>ExtendedItem : Symbol(ExtendedItem, Decl(nestedExcessPropertyChecking.ts, 68, 1))
178+
>BaseItem : Symbol(BaseItem, Decl(nestedExcessPropertyChecking.ts, 62, 2))
179+
180+
description: string | null
181+
>description : Symbol(description, Decl(nestedExcessPropertyChecking.ts, 69, 32))
182+
183+
};
184+
185+
type BaseValue = {
186+
>BaseValue : Symbol(BaseValue, Decl(nestedExcessPropertyChecking.ts, 71, 2))
187+
188+
// there are other fields
189+
items: BaseItem[];
190+
>items : Symbol(items, Decl(nestedExcessPropertyChecking.ts, 73, 18))
191+
>BaseItem : Symbol(BaseItem, Decl(nestedExcessPropertyChecking.ts, 62, 2))
192+
}
193+
type ExtendedValue = BaseValue & {
194+
>ExtendedValue : Symbol(ExtendedValue, Decl(nestedExcessPropertyChecking.ts, 76, 1))
195+
>BaseValue : Symbol(BaseValue, Decl(nestedExcessPropertyChecking.ts, 71, 2))
196+
197+
// there are other fields
198+
items: ExtendedItem[];
199+
>items : Symbol(items, Decl(nestedExcessPropertyChecking.ts, 77, 34))
200+
>ExtendedItem : Symbol(ExtendedItem, Decl(nestedExcessPropertyChecking.ts, 68, 1))
201+
}
202+
203+
const TEST_VALUE: ExtendedValue = {
204+
>TEST_VALUE : Symbol(TEST_VALUE, Decl(nestedExcessPropertyChecking.ts, 82, 5))
205+
>ExtendedValue : Symbol(ExtendedValue, Decl(nestedExcessPropertyChecking.ts, 76, 1))
206+
207+
items: [
208+
>items : Symbol(items, Decl(nestedExcessPropertyChecking.ts, 82, 35))
209+
210+
{id: 1, description: null},
211+
>id : Symbol(id, Decl(nestedExcessPropertyChecking.ts, 84, 9))
212+
>description : Symbol(description, Decl(nestedExcessPropertyChecking.ts, 84, 15))
213+
214+
{id: 2, description: 'wigglytubble'},
215+
>id : Symbol(id, Decl(nestedExcessPropertyChecking.ts, 85, 9))
216+
>description : Symbol(description, Decl(nestedExcessPropertyChecking.ts, 85, 15))
217+
218+
]
219+
};
220+

tests/baselines/reference/nestedExcessPropertyChecking.types

+55
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,58 @@ const response: Query = {
160160
},
161161
};
162162

163+
// Repro from #53412
164+
165+
type BaseItem = {
166+
>BaseItem : { id: number; }
167+
168+
id: number;
169+
>id : number
170+
}
171+
type ExtendedItem = BaseItem & {
172+
>ExtendedItem : BaseItem & { description: string | null; }
173+
174+
description: string | null
175+
>description : string | null
176+
177+
};
178+
179+
type BaseValue = {
180+
>BaseValue : { items: BaseItem[]; }
181+
182+
// there are other fields
183+
items: BaseItem[];
184+
>items : BaseItem[]
185+
}
186+
type ExtendedValue = BaseValue & {
187+
>ExtendedValue : BaseValue & { items: ExtendedItem[]; }
188+
189+
// there are other fields
190+
items: ExtendedItem[];
191+
>items : ExtendedItem[]
192+
}
193+
194+
const TEST_VALUE: ExtendedValue = {
195+
>TEST_VALUE : ExtendedValue
196+
>{ items: [ {id: 1, description: null}, {id: 2, description: 'wigglytubble'}, ]} : { items: ({ id: number; description: null; } | { id: number; description: string; })[]; }
197+
198+
items: [
199+
>items : ({ id: number; description: null; } | { id: number; description: string; })[]
200+
>[ {id: 1, description: null}, {id: 2, description: 'wigglytubble'}, ] : ({ id: number; description: null; } | { id: number; description: string; })[]
201+
202+
{id: 1, description: null},
203+
>{id: 1, description: null} : { id: number; description: null; }
204+
>id : number
205+
>1 : 1
206+
>description : null
207+
208+
{id: 2, description: 'wigglytubble'},
209+
>{id: 2, description: 'wigglytubble'} : { id: number; description: string; }
210+
>id : number
211+
>2 : 2
212+
>description : string
213+
>'wigglytubble' : "wigglytubble"
214+
215+
]
216+
};
217+

tests/cases/compiler/nestedExcessPropertyChecking.ts

+25
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,28 @@ const response: Query = {
6363
},
6464
},
6565
};
66+
67+
// Repro from #53412
68+
69+
type BaseItem = {
70+
id: number;
71+
}
72+
type ExtendedItem = BaseItem & {
73+
description: string | null
74+
};
75+
76+
type BaseValue = {
77+
// there are other fields
78+
items: BaseItem[];
79+
}
80+
type ExtendedValue = BaseValue & {
81+
// there are other fields
82+
items: ExtendedItem[];
83+
}
84+
85+
const TEST_VALUE: ExtendedValue = {
86+
items: [
87+
{id: 1, description: null},
88+
{id: 2, description: 'wigglytubble'},
89+
]
90+
};

0 commit comments

Comments
 (0)