How should object destructuring be properly applied for methods within ES6 classes?
user.ts
import { Request, Response } from "express";
export class User {
constructor (){
Object.assign(this,{
root:this.root,
get:this.get
})
}
public root(req: Request, res: Response) {
res.status(200).send({
message: "DEFAULT request successful!!"
});
}
public get(req: Request, res: Response){
res.status(200).send({
message: "USER request successful!!"
});
}
}
export const user = new User();
And I import it like this
import {root,get} from './user'
However, it throws a "has no exported member" error
UPDATE
Following comments, I modified my export to the following
let obj = new User();
export const user = {
root:obj.root,
get:obj.get
}
The same error persists