I am having issues trying to type the function parameters in this line of code:
pool: {
afterCreate: (conn, cb) => conn.run('PRAGMA foreign_keys = ON', cb),
},
Entire file code:
import { knex as setupKnex, Knex } from 'knex'
import { env } from './env'
export const config: Knex.Config = {
client: env.DATABASE_CLIENT,
connection: {
filename: env.DATABASE_URL,
},
useNullAsDefault: true,
pool: {
afterCreate: (conn, cb) => conn.run('PRAGMA foreign_keys = ON', cb),
},
migrations: {
extension: 'ts',
directory: './src/database/migrations',
},
}
export const knex = setupKnex(config)
Should I just use any to type the params?
I tried going to the types file of the Knex framework, however they type afterCreate: function without typing the params. For example:
interface PoolConfig {
name?: string;
afterCreate?: function;
min?: number;
max?: number;
refreshIdle?: boolean;
idleTimeoutMillis?: number;
reapIntervalMillis?: number;
returnToHead?: boolean;
priorityRange?: number;
log?: (message: string, logLevel: string) => void;