I have the following in Typescript:
import sql = require("mssql");
const config: sql.config = {....
}
const connect = async() => {
    return new Promise((resolve, reject) => {
        new sql.ConnectionPool(config).connect((err) => {
            if (err) {
                reject(err);
            } else {
                console.log("CONNECTED");
                resolve();
            }
        });
    });
};
(async() => {
    await connect().then(
        () => {
            console.log("Connection pool created successfully.");
        }).catch((err) => {
        console.error(err);
    });
})();
console.log("Now proceeding to load...");
I always get the console output in the following order:
Now proceeding to load...
CONNECTED
Connection pool created successfully
What have I done wrong? How do I achieve executing the last line of code only after all the activities before it have completed execution?
 
     
     
     
    