11import COMMANDS from '../commands' ;
2- import RedisSocket , { RedisSocketOptions , RedisTcpSocketOptions } from './socket' ;
2+ import RedisSocket , { RedisSocketOptions } from './socket' ;
33import { BasicAuth , CredentialsError , CredentialsProvider , StreamingCredentialsProvider , UnableToObtainNewCredentialsError , Disposable } from '../authx' ;
44import RedisCommandsQueue , { CommandOptions } from './commands-queue' ;
55import { EventEmitter } from 'node:events' ;
@@ -429,7 +429,7 @@ export default class RedisClient<
429429 return parsed ;
430430 }
431431
432- readonly #options? : RedisClientOptions < M , F , S , RESP , TYPE_MAPPING > ;
432+ readonly #options: RedisClientOptions < M , F , S , RESP , TYPE_MAPPING > ;
433433 #socket: RedisSocket ;
434434 readonly #queue: RedisCommandsQueue ;
435435 #selectedDB = 0 ;
@@ -541,10 +541,10 @@ export default class RedisClient<
541541
542542 }
543543
544- #initiateOptions( options ? : RedisClientOptions < M , F , S , RESP , TYPE_MAPPING > ) : RedisClientOptions < M , F , S , RESP , TYPE_MAPPING > | undefined {
544+ #initiateOptions( options : RedisClientOptions < M , F , S , RESP , TYPE_MAPPING > = { } ) : RedisClientOptions < M , F , S , RESP , TYPE_MAPPING > {
545545
546546 // Convert username/password to credentialsProvider if no credentialsProvider is already in place
547- if ( ! options ? .credentialsProvider && ( options ? .username || options ? .password ) ) {
547+ if ( ! options . credentialsProvider && ( options . username || options . password ) ) {
548548
549549 options . credentialsProvider = {
550550 type : 'async-credentials-provider' ,
@@ -555,19 +555,19 @@ export default class RedisClient<
555555 } ;
556556 }
557557
558- if ( options ? .database ) {
558+ if ( options . database ) {
559559 this . _self . #selectedDB = options . database ;
560560 }
561561
562- if ( options ? .commandOptions ) {
562+ if ( options . commandOptions ) {
563563 this . _commandOptions = options . commandOptions ;
564564 }
565565
566- if ( options ? .maintNotifications !== 'disabled' ) {
567- EnterpriseMaintenanceManager . setupDefaultMaintOptions ( options ! ) ;
566+ if ( options . maintNotifications !== 'disabled' ) {
567+ EnterpriseMaintenanceManager . setupDefaultMaintOptions ( options ) ;
568568 }
569569
570- if ( options ? .url ) {
570+ if ( options . url ) {
571571 const parsedOptions = RedisClient . parseOptions ( options ) ;
572572 if ( parsedOptions ?. database ) {
573573 this . _self . #selectedDB = parsedOptions . database ;
@@ -748,8 +748,7 @@ export default class RedisClient<
748748 commands . push ( { cmd : this . #clientSideCache. trackingOn ( ) } ) ;
749749 }
750750
751- const { tls, host } = this . #options! . socket as RedisTcpSocketOptions ;
752- const maintenanceHandshakeCmd = await EnterpriseMaintenanceManager . getHandshakeCommand ( ! ! tls , host ! , this . #options! ) ;
751+ const maintenanceHandshakeCmd = await EnterpriseMaintenanceManager . getHandshakeCommand ( this . #options) ;
753752 if ( maintenanceHandshakeCmd ) {
754753 commands . push ( maintenanceHandshakeCmd ) ;
755754 } ;
0 commit comments