I am facing an issue in my Node.js app, where the log says "Invalid shorthand initializer". However, I checked online, and the official syntax to declare super constructor objects, is by doing objectname = {property: 'X'};
However, for the options = { line, it gives me this error message.
What am I doing wrong here? How is options declared correctly?
const { Sequelize } = require("sequelize");
module.exports = class Database extends Sequelize {
constructor() {
super({
database : process.env.DatabaseName,
username : process.env.DatabaseUsername,
password : process.env.DatabasePassword,
options = {
host: process.env.DatabaseHost,
dialect: "mysql"
}
})
};
Authenticate() {
this
.authenticate()
.then(() => console.log(`Logged in to Database ${process.env.DatabaseName}!`))
.catch(err => console.log(err));
};
};
My dependencies in the package.json:
"dependencies": {
"abort-controller": "^3.0.0",
"asynckit": "^0.4.0",
"callsites": "^3.1.0",
"combined-stream": "^1.0.8",
"delayed-stream": "^1.0.0",
"discord-api-types": "^0.20.2",
"discord.js": "^13.3.1",
"dot-prop": "^6.0.1",
"dotenv": "^10.0.0",
"event-target-shim": "^5.0.1",
"form-data": "^3.0.1",
"is-obj": "^2.0.0",
"lodash.isequal": "^4.5.0",
"mime-db": "^1.51.0",
"mime-types": "^2.1.34",
"mysql2": "^2.3.3",
"node-fetch": "^2.6.6",
"ow": "^0.27.0",
"sequelize": "^6.12.0-alpha.1",
"tr46": "^0.0.3",
"ts-mixer": "^6.0.0",
"tslib": "^2.3.1",
"type-fest": "^1.4.0",
"vali-date": "^1.0.0",
"webidl-conversions": "^3.0.1",
"whatwg-url": "^5.0.0",
"ws": "^8.2.3"
}
Looking forward to your answers guys.
Thank you for your help :)