@@ -346,7 +346,7 @@ class Cluster extends Commander {
346346 /**
347347 * Get nodes with the specified role
348348 */
349- nodes ( role : NodeRole = "all" ) : any [ ] {
349+ nodes ( role : NodeRole = "all" ) : Redis [ ] {
350350 if ( role !== "all" && role !== "master" && role !== "slave" ) {
351351 throw new Error (
352352 'Invalid role "' + role + '". Expected "all", "master" or "slave"'
@@ -696,7 +696,6 @@ class Cluster extends Commander {
696696 nextRound ( ) ;
697697 }
698698
699-
700699 /**
701700 * Change cluster instance's status
702701 */
@@ -785,7 +784,7 @@ class Cluster extends Commander {
785784 : nodeKey ;
786785 }
787786
788- private getInfoFromNode ( redis , callback ) {
787+ private getInfoFromNode ( redis : Redis , callback ) {
789788 if ( ! redis ) {
790789 return callback ( new Error ( "Node is disconnected" ) ) ;
791790 }
@@ -808,7 +807,7 @@ class Cluster extends Commander {
808807 duplicatedConnection . on ( "error" , noop ) ;
809808
810809 duplicatedConnection . cluster (
811- "slots " ,
810+ "SLOTS " ,
812811 timeout ( ( err , result ) => {
813812 duplicatedConnection . disconnect ( ) ;
814813 if ( err ) {
@@ -827,7 +826,7 @@ class Cluster extends Commander {
827826 callback ( ) ;
828827 return ;
829828 }
830- const nodes = [ ] ;
829+ const nodes : RedisOptions [ ] = [ ] ;
831830
832831 debug ( "cluster slots result count: %d" , result . length ) ;
833832
@@ -841,10 +840,13 @@ class Cluster extends Commander {
841840 if ( ! items [ j ] [ 0 ] ) {
842841 continue ;
843842 }
844- items [ j ] = this . natMapper ( { host : items [ j ] [ 0 ] , port : items [ j ] [ 1 ] } ) ;
845- items [ j ] . readOnly = j !== 2 ;
846- nodes . push ( items [ j ] ) ;
847- keys . push ( items [ j ] . host + ":" + items [ j ] . port ) ;
843+ const node = this . natMapper ( {
844+ host : items [ j ] [ 0 ] ,
845+ port : items [ j ] [ 1 ] ,
846+ } ) ;
847+ node . readOnly = j !== 2 ;
848+ nodes . push ( node ) ;
849+ keys . push ( node . host + ":" + node . port ) ;
848850 }
849851
850852 debug (
@@ -896,7 +898,7 @@ class Cluster extends Commander {
896898 * Check whether Cluster is able to process commands
897899 */
898900 private readyCheck ( callback : Callback < void | "fail" > ) : void {
899- ( this as any ) . cluster ( "info " , function ( err , res ) {
901+ this . cluster ( "INFO " , function ( err , res ) {
900902 if ( err ) {
901903 return callback ( err ) ;
902904 }
0 commit comments