I do want to export my ormConfig from a TypeScript file located by the path src/config/ormconfig.ts with the following content
export const ormConfig = {
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'admin',
password: '123456',
database: 'hello-world',
}
So I could import it from the file src/database/index.ts using the following strategy:
import { DataSource } from "typeorm";
import { ormConfig } from "../config/ormconfig";
const dataSource: DataSource = new DataSource(ormConfig);
The problem is that TypeScript throws an error saying arguments are missing: "[...] is missing the following properties from type 'AuroraMysqlConnectionOptions': region, secretArn, resourceArnts"
Has someone have a workaround for this issue? Thanks in advance
CodePudding user response:
You just need to specify the type of your ormConfig
import { PostgresConnectionOptions } from "typeorm/driver/postgres/PostgresConnectionOptions";
const ormConfig: PostgresConnectionOptions = {