mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Don't eagerly get apparent type of spread expression contextual type (#44002)
* Don't get apparent type of contextual type for spread expressions * Add regression test
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// @strict: true
|
||||
// @declaration: true
|
||||
|
||||
// Repro from #43966
|
||||
|
||||
interface Orange {
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Apple {
|
||||
name: string;
|
||||
}
|
||||
|
||||
function test<T extends Apple | Orange>(item: T): T {
|
||||
return { ...item };
|
||||
}
|
||||
|
||||
function test2<T extends Apple | Orange>(item: T): T {
|
||||
const x = { ...item };
|
||||
return x;
|
||||
}
|
||||
Reference in New Issue
Block a user