feat: add duplicate() method to RedisSentinel by claygeo · Pull Request #3212 · redis/node-redis

@claygeo

RedisClient and RedisCluster both expose a duplicate() method that
creates a new instance with the same options (plus optional
overrides). RedisSentinel is missing this method, which forces
users to manually reconstruct the sentinel configuration when they
need a second connection (e.g., for pub/sub alongside regular
commands).

Adds duplicate() to the RedisSentinel class following the exact
same pattern used by RedisClient and RedisCluster:
- Creates a new instance via Object.getPrototypeOf(this).constructor
- Spreads existing options + commandOptions + overrides
- Returns the correctly typed RedisSentinelType

Closes redis#3107