Here\'s a snippet in which I instantiate a new content object in my service:
const newContent = new Content(
result.obj.name
result.ob
You can pass an object to the constructor which wraps all of those variables:
type ContentData = {
name: string;
user: string;
content_id: string;
user_id: string;
}
class Content {
constructor(data: ContentData) {
...
}
}
And then:
const newContent = new Content({
name: result.obj.name,
user: result.obj.user.
content_id: result.obj._id,
user_id: result.obj.user._id,
});