sequelize / sequelize-pool

Resource pool implementation. It can be used to throttle expensive resources.
Other
38 stars 17 forks source link

feat: tsconfig: target node >= 10 #43

Closed FauxFaux closed 3 years ago

FauxFaux commented 3 years ago

The current target (es6) doesn't support async/await, so typescript polyfills it for us, with a weird mess of __awaiter and yield. If we target node >= 8, the compiler just emits the async/await code we wrote, which leads to happier monitoring tools.

sequelize 6 supports node >= 10, and sequelize 5 pins an older version of this library. We already declare engines >= 10 in package.json.

Pin typescript version to 4.2 (they don't do semver).

c.f. https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-10

lib/Pool.js before:

    destroyAllNow() {
        return __awaiter(this, void 0, void 0, function* () {
...
            for (const resource of resources) {
                try {
                    yield this.destroy(resource);
                }

After:

    async destroyAllNow() {
...
        for (const resource of resources) {
            try {
                await this.destroy(resource);
            }