When writing logs from sync typeORM to a file, an error occurs:
error TS2322: Type '(config: ConfigService) => Promise<{ type: "postgres"; host: string; port: number; password: string; username: string; database: string; logging: string[]; maxQueryExecutionTime: number; logger: string; subscribers: (typeof TruckSubscriber | typeof RequestSubscriber)[]; entities: (typeof Request | ... 14 more ... | ...' is not assignable to type '(...args: any[]) => TypeOrmModuleOptions | Promise<TypeOrmModuleOptions>'
useFactory: getTypeormConfig, //: Promise<TypeOrmModuleOptions>
~~~~~~~~~~
node_modules/@nestjs/typeorm/dist/interfaces/typeorm-options.interface.d.ts:44:5
44 useFactory?: (...args: any[]) => Promise<TypeOrmModuleOptions> | TypeOrmModuleOptions;
~~~~~~~~~~
The expected type comes from property 'useFactory' which is declared here on type 'TypeOrmModuleAsyncOptions'
From the TypeORM documentation: You can enable any of them in the data source options:
{
host: "localhost",
...
logging: true,
logger: "file"
}
This doesn't work for me - exactly logger: "file" doesn't work. logging: true, works successfully logging also doesn't work: ['error', 'schema', 'warn'],