4 ms·
Does the new inference allow incremental construction of objects? interface Color { isRed: boolean, name: string } function exampl
by grayrest 10y ago
Does the new inference allow incremental construction of objects?
interface Color {
isRed: boolean,
name: string
}
function example(): Color {
let x = {};
x.isRed = false;
x.name = "Cerulean";
return x;
}
Obviously you'd just build the object at once for something this simple, but for larger/more complex objects it becomes trickier.