Skip to content

Question: Does sequelize-typescript support typed returns based on included associations? #1745

Open
@ccmetz

Description

@ccmetz

For example, I have an appointments model and a patient model. The appointment model has a patientId. Is there a way to define the types so that:

appointment.findByPk(appointmentId, {include: [{model: db.patient}]});

results in a return type that includes the patient object on it? And vice-versa, if I don't include the patient model, can I get a return type where the patient object is not defined? I have the associations defined with decorators on the appointment class but it seems to always assume that patient will be present on the appointment object.

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