Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ccmetz opened this issue Apr 25, 2025 · 0 comments

Comments

@ccmetz
Copy link

ccmetz commented Apr 25, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant