1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Support esModuleInterop set to false. (#1717)

* Support esModuleInterop set to false.

When testing the upcoming 4.x release, we got a bunch of typescript
errors emitted from this project.

We quickly realized this is because the library uses the esModuleInterop
flag. This makes some imports _slightly_ easier to write, but it comes
at a cost: it forces any application or library using this library to
*also* have esModuleInterop on.

The `esModuleInterop` flag is a bit of a holdover from an earlier time,
and I would not recommend using it in libraries. The main issue is that
if it's set to true, you are forcing any users of the library to also
have `esModuleInterop`, where if you keep have it set to `false` (the
default), you leave the decision to the user.

This change should have no rammifications to users with
`esModuleInterop` on, but it will enable support for those that have it
off.

This is especially good for library authors such as myself, because I
would also like to keep this flag off to not force *my* users into this
feature.

* All tests now pass!

* Move @types/redis-parser into client sub-package

and removed a comma
This commit is contained in:
Evert Pot
2021-11-15 16:52:48 -05:00
committed by GitHub
parent ddf539ad5f
commit 7d2629f083
10 changed files with 104 additions and 64 deletions

View File

@@ -3,7 +3,7 @@ import { once } from 'events';
import { RedisModules, RedisScripts } from '@redis/client/lib/commands';
import RedisClient, { RedisClientType } from '@redis/client/lib/client';
import { promiseTimeout } from '@redis/client/lib/utils';
import path from 'path';
import * as path from 'path';
import { promisify } from 'util';
import { exec } from 'child_process';
const execAsync = promisify(exec);