interface Test {
a: string;
b: number;
c: number;
}
const test = {
a: 'a',
b: 1,
d: []
};
delete test.d;
const test2:Test = { ...test, c:1 };
=> Type '{ a: string; b: number; c: number; d: never[]; }' is not assignable to type 'Test'.
=> Object literal may only specify known properties, and 'd' does not exist in type 'Test'.
I deleted d property by delete operator, but I got a error like that.
Is there a way for the situation?
const test2:Test = { ...test, c:1 } as Test;is acceptably.