我是一个不知道怎么做的新手,Knes有两个变量名,我应该如何获得返回我想要的变量的方法。
import {knex, Knex} from 'knex'
'migrations'}}const createConnection():承诺{const config: Knex.Config = {client:'mysql',连接:{主机: this.config.host,端口: this.config.port,用户: this.config.user,密码: this.config.password,数据库:host.config.database},调试: this.config.debug,迁移:{tableName: createConnection db =k奈(Config)`
await db.raw('select 1');
return db;
}`上述代码webstorm报告了一个错误。
发布于 2022-03-27 02:20:58
public async createConnection(): Promise<Knex> {
const config: Knex.Config = {
client: 'mysql',
connection: {
host: this.config.host,
port: this.config.port,
user: this.config.user,
password: this.config.password,
database: this.config.database
},
debug: this.config.debug,
migrations: {
tableName: 'migrations'
}
}
const db: Knex = knex(config)
await db.raw('select 1');
return db;
}https://stackoverflow.com/questions/71628676
复制相似问题