Use automerge for defaults and ensure correct typing.

Review Request #13895 — Created May 24, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

This change accomplishes 3 things related to the defaults member for
models.

First, it fixes up the typing for the defaults definitions in all the
models that we've implemented so far to be Result<Partial<AttrsType>>.

Second, for things that inherit from base classes, we now rely on
automerge instead of manually calling _.defaults().

Finally, we had a few instances where the defaults were including
objects or arrays but were implemented as a plain object instead of a
function. We've had problems in the past where these weren't deep
copied, and multiple objects ended up sharing the same object or array
value. These have been fixed up to always be a function that returns new
data.

Ran js-tests.

Commits

Files