typeorm中的createContection已经被废弃,改为DataSource,dataSource.initialize()方法会连接数据库,返的是个promise.
const con = new DataSource({
type: 'mssql',
...options,
options: {
encrypt: false,
},
})
con.initialize().then( dbcon => {
console.log('ok')
}).catch(error => {
console.log(error)
})