mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-08 12:55:49 -05:00
Add regression test
This commit is contained in:
11
tests/cases/compiler/genericIsNeverEmptyObject.ts
Normal file
11
tests/cases/compiler/genericIsNeverEmptyObject.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// @strict: true
|
||||
|
||||
// Repro from #29067
|
||||
|
||||
function test<T extends { a: string }>(obj: T) {
|
||||
let { a, ...rest } = obj;
|
||||
return { ...rest, b: a };
|
||||
}
|
||||
|
||||
let o1 = { a: 'hello', x: 42 };
|
||||
let o2: { b: string, x: number } = test(o1);
|
||||
Reference in New Issue
Block a user