即时消息错误为Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead. (no-angle-bracket-type-assertion)tslint(1)
如果我在tslint中将其关闭一分钟,则会收到有关不使用任何内容的错误消息。
设置类型的正确方法是什么?
// Connect to MongoDB
(<any> mongoose).Promise = bluebird;
mongoose.connect(`mongodb+srv://${process.env.DB_USERNAME}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}/${process.env.DB_NAME}?retryWrites=true`,
{useCreateIndex: true, useNewUrlParser: true});
mongoose.connection.on('error', () => {
throw new Error(`unable to connect to database: ${process.env.DB_NAME}`);
});