Base entity instance passed to the .methods(...) builder: validated props
plus the with and toJSON helpers, before domain methods attach.
with(...) is typed as returning the base instance here because the final
methods object is still being defined while the builder runs. At runtime
the returned instance carries the entity's methods, and EntityInstance
maps base-instance returns back to the full instance type so consumers keep
typed method chaining.
Base entity instance passed to the
.methods(...)builder: validated props plus thewithandtoJSONhelpers, before domain methods attach.with(...)is typed as returning the base instance here because the final methods object is still being defined while the builder runs. At runtime the returned instance carries the entity's methods, andEntityInstancemaps base-instance returns back to the full instance type so consumers keep typed method chaining.