Shallow copy
Also called: Deep copy
A copy of an object's top-level fields in which nested objects are still shared with the original.
Definition
Changing a nested list or object through the copy changes the original too, because there is only one of it. A deep copy also copies the nested objects. Kotlin data class copy(), TypeScript object spread and Java clone() are shallow; Swift structs whose fields are all value types copy deeply. Immutable nested data makes sharing safe.
In practice
copy = original.copy() followed by copy.items.add(extra) adds the line to the original invoice as well.