File tree 4 files changed +12
-12
lines changed
4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export default abstract class BaseNode extends EventEmitter {
41
41
public shardCount ?: number ;
42
42
43
43
public connection ?: Connection ;
44
- public players : PlayerStore = new PlayerStore ( this ) ;
44
+ public players : PlayerStore < this > = new PlayerStore ( this ) ;
45
45
public http ?: Http ;
46
46
47
47
public voiceStates : Map < string , string > = new Map ( ) ;
Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ export interface Options extends WebSocket.ClientOptions {
21
21
resumeTimeout ?: number ;
22
22
}
23
23
24
- export default class Connection {
25
- public readonly node : Node ;
24
+ export default class Connection < T extends Node = Node > {
25
+ public readonly node : T ;
26
26
public url : string ;
27
27
public options : Options ;
28
28
public resumeKey ?: string ;
@@ -68,8 +68,8 @@ export default class Connection {
68
68
69
69
private _queue : Array < Sendable > = [ ] ;
70
70
71
- constructor ( client : Node , url : string , options : Options = { } ) {
72
- this . node = client ;
71
+ constructor ( node : T , url : string , options : Options = { } ) {
72
+ this . node = node ;
73
73
this . url = url ;
74
74
this . options = options ;
75
75
this . resumeKey = options . resumeKey ;
Original file line number Diff line number Diff line change @@ -35,12 +35,12 @@ export interface JoinOptions {
35
35
deaf ?: boolean ;
36
36
}
37
37
38
- export default class Player extends EventEmitter {
39
- public readonly node : Node ;
38
+ export default class Player < T extends Node = Node > extends EventEmitter {
39
+ public readonly node : T ;
40
40
public guildID : string ;
41
41
public status : Status = Status . INSTANTIATED ;
42
42
43
- constructor ( node : Node , guildID : string ) {
43
+ constructor ( node : T , guildID : string ) {
44
44
super ( ) ;
45
45
this . node = node ;
46
46
this . guildID = guildID ;
Original file line number Diff line number Diff line change 1
1
import Player from './Player' ;
2
2
import Node from '../base/Node' ;
3
3
4
- export default class PlayerStore extends Map < string , Player > {
5
- public readonly node : Node ;
4
+ export default class PlayerStore < T extends Node = Node > extends Map < string , Player < T > > {
5
+ public readonly node : T ;
6
6
7
- constructor ( node : Node ) {
7
+ constructor ( node : T ) {
8
8
super ( ) ;
9
9
this . node = node ;
10
10
}
11
11
12
- public get ( key : string ) : Player {
12
+ public get ( key : string ) : Player < T > {
13
13
let player = super . get ( key ) ;
14
14
if ( ! player ) {
15
15
player = new Player ( this . node , key ) ;
You can’t perform that action at this time.
0 commit comments