Skip to content

Typo in defineRelationsPart docs: Incorrect spread syntax in explanation #629

@ashersamuel8

Description

@ashersamuel8

I found a typo in the documentation for the new defineRelationsPart API (specifically in the "Relations Parts" / "Rule 1" section).
In the explanation of why the order matters, the documentation currently repeats the same code snippet for both the "correct" and "incorrect" scenarios.

The Issue

The text states:

Having { ...relations, ...part } will result in [...]
 and having { ...relations, ...part } will result in [...]

The second instance repeats the first one, making it impossible to see the difference in the resulting object structure.

Suggested Fix

  • The second sentence should demonstrate the inverse order to match the context of the warning:

and having { ...part, ...relations } will result in [...]

Reasoning
The documentation is trying to explain that defineRelations creates empty placeholders (e.g., posts: {}) for all tables. If relations (the main object) is spread last, its empty placeholders overwrite the actual relation definitions defined in part. The current text fails to illustrate this because it uses the "correct" spread order (...relations, ...part) in the "incorrect" example text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions