You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@boost3000, I did a test using PhpStorm and everything worked perfectly:
Could you confirm if this error is exclusive to PhpStorm or if it also occurs in other editors?
It might help to know your tsconfig.json configs (if used), the Node.js version and less likely, but make sure you DON'T have @types/mysql2 installed (MySQL2 has its own built-in typings) 🙋🏻♂️
Also, to use MySQL2 with TypeScript, you need to install @types/node as a development dependency.
i use mysql2 like this:
require('dotenv').config({path: __dirname + '/.env'});
const mysql = require('mysql2/promise');
module.exports = mysql.createPool({
"host": process.env.DB_HOST,
"user": process.env.DB_USER,
"port": parseInt(process.env.NODE_ENV === 'production' ? process.env.DB_PORT_PROD : process.env.DB_PORT_DEV),
"password": process.env.DB_PASSWORD,
"waitForConnections": process.env.DB_WAIT_FOR_CONNECTIONS === 'true',
"connectionLimit": parseInt(process.env.DB_CONNECTION_LIMIT),
"queueLimit": parseInt(process.env.DB_QUEUE_LIMIT),
"dateStrings": [
"DATE",
"DATETIME"
],
maxPreparedStatements: 100,
jsonStrings: true
});
and require it in another file. type hints are not working at all in phpstorm
The text was updated successfully, but these errors were encountered: