В Node.js приложении Я делаю 2 запроса sql библиотекой sequelize . Затем я комбинирую результат обоих запросов в Promise.
router.post('/notification', function(request, response) {
const survey_id = request.query.survey_id;
const employees = sequelize.query('SELECT ARRAY_AGG (EMPLOYEE) AS EMPLOYEES FROM SURVEYS_EMPLOYEES_RELATIONSHIP WHERE SURVEY_ID = :survey_id AND STATUS = FALSE', {
replacements: {
survey_id: survey_id,
},
type: sequelize.QueryTypes.SELECT,
});
const templates = sequelize.query('SELECT TEMPLATE FROM TEMPLATES WHERE ID = 1', {
type: sequelize.QueryTypes.SELECT,
});
Promise.all([employees, templates]).then(responses => {
console.log(responses[0][0]["employees"]);
console.log(responses[1][0]["template"]);
}).catch(error => {
console.log(error);
});
});
При запуске приложения выдается следующее предупреждение:
Argument type [Promise, Promise] is not assignable to parameter type [(PromiseLike<T>|T), ...]
Как я могу исправить это предупреждение? Кажется, что-то не так с этой частью кода:
.all([employees, templates])
.