Consider I have this:
mongoose.connection.on('error', function (err) {
if (err) {
throw err;
}
});
How do I convert this to ES2015 syntax?
I tried:
export class MongooseConnectionUtil extends MongooseUtil {
constructor(...args) {
super(...args);
this.connection = mongoose.connection;
}
on('error', err) => err {
if (err) {
throw err;
}
}
also tried with the ()
on('error', ()) => err {
if (err) {
throw err;
}
}
Aucun commentaire:
Enregistrer un commentaire