Commit 1e18ff6
committed
perf(ts)!: move multi() away from RedisClient
RedisClientMultiCommandType is slow to typecheck because of its recursive
nature and the fact that it has many ( around 700 ) methods.
Most of the users dont use multi(), so there is no point to incur the ts
costs to them. One possible solution is to move the multi() method away from
the main RedisClient, thus typechecking will not apply to RedisClientMultiCommandType.
This is a breaking change.
Usage before:
import { createClient } from 'redis';
const client = createClient();
cont result = await client.multi()
.set('foo', 3)
.get('bar')
.execTyped();
Usage after:
import { createClient, multi } from 'redis';
const client = createClient();
cont result = await multi(client)
.set('foo', 3)
.get('bar')
.execTyped();1 parent 6eed1ee commit 1e18ff6
2 files changed
+14
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
| 438 | + | |
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| |||
1315 | 1315 | | |
1316 | 1316 | | |
1317 | 1317 | | |
1318 | | - | |
1319 | | - | |
1320 | | - | |
1321 | | - | |
1322 | | - | |
1323 | | - | |
1324 | | - | |
1325 | | - | |
1326 | | - | |
1327 | | - | |
1328 | | - | |
1329 | 1318 | | |
1330 | 1319 | | |
1331 | 1320 | | |
| |||
0 commit comments