I'm writing an app in typescript that connects to a PG data base (using the node-postgres package).
I have this:
import { Pool } from 'pg';
const pool = new Pool({
user: process.env.RED_USER,
database: process.env.RED_DB,
password: process.env.RED_PASS,
port: Number(process.env.RED_PORT),
host: process.env.RED_HOST,
});
Which generates the following error on the new:
ESLint: Unsafe construction of an any type value.(@typescript-eslint/no-unsafe-call)
Which is odd as my IDE infers the variable to have the Pool type. I've got the @types/pg package installed as well.
tsconfig.json:
{
"compilerOptions": {
"rootDir": ".",
"outDir": "build",
"moduleResolution": "Node",
"target": "ES2020",
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"index.ts",
"src/**/*.ts"
]
}
What might be going on here? I didn't find any solution in my googling and am still new to typescript.