Closed gordonwho closed 5 months ago
All, I am getting the following error :
Type 'Query' must have a '[Symbol.iterator]()' method that returns an iterator.ts(2488)
from the following code:
const connection = await getConnection(); let [columns] = await connection.query(`desc ${data.tableName}`);
Below is the code for getconnection
async function getConnection() { // const config = await getConnectionConfig(process.env.DB_SECRET || 'database/wmsRW'); const config = await getConnectionConfig(process.env.DB_SECRET || 'database/wmsRW'); try { const connection = await mysql.createConnection({ host: config.host, password: config.password, user: config.username, database: config.dbname }); return connection; } catch (e) { console.log(e); throw e; } }
Below are my settings: TyepScript: 5.3.3 NodeJs: 18.18
In package.json:
Dependencies { "mysql2" : "3.9.3" } DevDepdendencies { "@types/mysql": "2.15.5", }
In my tsconfig I have:
{ "extends": "@tsconfig/node18/tsconfig.json", "compilerOptions": { "lib": ["ES2022", "es2018", "es5", "es6", "dom", "dom.iterable"], } }
Any idea on how to fix the issue? Gordon
It's a express-serve-static-core package issue see here: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/43434
All, I am getting the following error :
from the following code:
Below is the code for getconnection
Below are my settings: TyepScript: 5.3.3 NodeJs: 18.18
In package.json:
In my tsconfig I have:
Any idea on how to fix the issue? Gordon