Repository navigation
javascript: a model made by an ORM factory carries its schema's statics - #1824
Merged
swapnilpaliwal-sd merged 2 commits intoSep 30, 2026
Conversation
`connection.model(name, schema)` builds the model class at runtime, so a call
such as `this.Doc.findLive()` on it had an untyped receiver and was only
matched by name, with same-named methods elsewhere as equal candidates.
The schema argument now gives the call a value: a `new Schema(...)` reached
through an import of the ORM package (named, default, namespace, require, or a
local destructure) is tracked, and whatever its `statics` holds (member
writes, `static('n', f)`, `static({...})`, the `statics` option) is a member
of every model made from it; its `methods` are members of `new Model(...)`.
The package's own members stay receiver_untyped as before.
Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
swapnilpaliwal-sd
requested review from
JaredHLZhang,
Whua689 and
suyashpaliwal26
as code owners
September 30, 2026 10:27
…factory-result-untyped
swapnilpaliwal-sd
deleted the
apps/javascript/orm-model-factory-result-untyped
branch
September 30, 2026 10:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
connection.model(name, schema)builds its model class at runtime, sothis.Doc.findLive()on the result had an untyped receiver and matched only by name, with same-named methods on unrelated classes as equal candidates.new Schema(...)reached through an import of the ORM package (named, default, namespace, require, or a local destructure; the package need not be installed).schema.staticsholds (member writes,static('n', f),static({...}), thestaticsoption) is a member of the model;schema.methodsare members ofnew Model(...);thisin a static is the model.find,create) stayreceiver_untyped, as before.74-orm-model-factory, with controls: a schema from a package that isn't modelled, a projectregistry.model(name, obj), and a same-named method on an unrelated class. None of them change.Checked: JS engine suite 88/88 (with the compiler oracle), query cases 268/268. On the product graph, 19 sites go from
ambiguous_unknowntoknown_edgeand nothing is removed. Probes 56/70 before and after, and the two target probes are now[resolved]. Index time 42 s → 45 s.