TypeScript Version: 2.9.0-dev.20180411
Search Terms: object spread unused property
Code
interface Point { x: number; y: number; }
function withX(p: Point, x: number): Point {
if (something) {
return { x, x: p.x, y: p.y }; // Error
} else {
return { x, ...p }; // No error
}
}
Expected behavior:
Error at { x, ...p }: The first x is dead because ...p has its own non-optional x.
Actual behavior:
No error at { x, ...p }.
TypeScript Version: 2.9.0-dev.20180411
Search Terms: object spread unused property
Code
Expected behavior:
Error at
{ x, ...p }: The firstxis dead because...phas its own non-optionalx.Actual behavior:
No error at
{ x, ...p }.