@@ -14,10 +14,8 @@ import {
1414import { readHeader } from '../Util/Header' ;
1515import { NodeSocket } from './NodeSocket' ;
1616import { Node } from '../Node' ;
17+ import { Socket } from 'net' ;
1718
18- /**
19- * @extends {Map<string,QueueEntry> }
20- */
2119export class Queue extends Map < string , QueueEntry > {
2220
2321 private nodeSocket ! : NodeSocket ;
@@ -40,39 +38,22 @@ export class Queue extends Map<string, QueueEntry> {
4038
4139 /**
4240 * The name of the client that manages this instance
43- * @type {string }
4441 */
45- public get name ( ) {
46- return this . nodeSocket . name ;
42+ public get name ( ) : string {
43+ return this . nodeSocket . name ! ;
4744 }
4845
4946 /**
5047 * The socket contained in the client that manages this instance
51- * @type {Socket }
5248 */
53- public get socket ( ) {
54- return this . nodeSocket . socket ;
49+ public get socket ( ) : Socket {
50+ return this . nodeSocket . socket ! ;
5551 }
5652
57- /**
58- * @typedef {Object } QueueObject
59- * @property {string } id The id of the message
60- * @property {boolean } receptive Whether this message is receptive or not
61- * @property {Buffer } data The data received from the socket
62- * @private
63- */
64-
6553 /**
6654 * Returns a new Iterator object that parses each value for this queue.
67- * @name @@iterator
68- * @method
69- * @instance
70- * @generator
71- * @returns {Iterator<QueueObject|symbol> }
72- * @memberof Queue
7355 */
74-
75- public * process ( buffer : Buffer ) {
56+ public * process ( buffer : Buffer ) : IterableIterator < QueueObject | symbol > {
7657 if ( this . _rest ) {
7758 buffer = Buffer . concat ( [ this . _rest , buffer ] ) ;
7859 this . _rest = null ;
@@ -155,3 +136,9 @@ interface QueueEntry {
155136 resolve : ( value : any ) => void ;
156137 reject : ( error : Error ) => void ;
157138}
139+
140+ interface QueueObject {
141+ id : string ;
142+ receptive : boolean ;
143+ data : any ;
144+ }
0 commit comments