DimiMikadze / orca

Build modern community apps with React and Node.
https://dimimikadze.github.io/orca-docs
MIT License
1.22k stars 294 forks source link

Typescript Compile Error: 'typeof ObjectId' is not callable. #166

Closed ghost closed 3 years ago

ghost commented 3 years ago

Describe the bug The problem is from "orca/packages/orca-api/src/db/messages.ts" Typescript fails to compile, gives this error: Value of type 'typeof ObjectId' is not callable. Did you mean to include 'new'?ts(2348)

System Node.js version: 16.8.0

Example // CODE SNIPPET FROM: "orca/packages/orca-api/src/db/messages.ts"

import mongoose from 'mongoose'; import { Message, User } from '../models';

export const getConversations = async (authUserId: string): Promise => { const lastConversations = await Message.aggregate([ { $match: { $or: [ { receiver: mongoose.Types.ObjectId(authUserId), }, { sender: mongoose.Types.ObjectId(authUserId), }, ], }, },

DimiMikadze commented 3 years ago

@Ninjer Hi, Can you please fill in the "Steps to reproduce"?