Skip to content

Conversation

nkaradzhov
Copy link
Collaborator

@nkaradzhov nkaradzhov commented Sep 18, 2025

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();

Description

Describe your pull request here


Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant