-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
model.count doesn't always return a Promise<number> #10757
Comments
Could you add a specific overload that when You'd have to create an interface like |
The fix is incorrect. It should be { [key:string]: string }[], eg: const observations = await Observation.count({
include: [
{
model: User,
association: 'createdBy',
attributes: ['id', 'name', 'avatar']
},
],
attributes: ['createdBy.name', 'createdBy.color', 'createdBy.id'],
group: ['createdBy.name', 'createdBy.color', 'createdBy.id']
}); returns [ { "name": "Matt Davidson",
"color": "#0000",
"id": "aa6776b8-d402-4817-8335-d12257d13df4",
"count": "1" } ] Note that count is not a number it's actually a string |
Maybe it should be
|
@mjdavidson Is this still an issue? |
don't think so, |
sequelize/types/lib/model.d.ts
Line 1751 in 728707c
if you use group/attributes it will return an array of objects
The text was updated successfully, but these errors were encountered: