That is, properties in an object literal type that came from a spread assignment never cause an excess property error.
3 lines
164 B
TypeScript
3 lines
164 B
TypeScript
type A = { a: string, b: string };
|
|
const extra1 = { a: "a", b: "b", extra: "extra" };
|
|
const a1: A = { ...extra1 }; // spread should not give excess property errors
|